Compiler error: “Member names cannot be the same as their enclosing type”
Posted by: admin in UncategorizedThere are quite some articles on this small issue but what I would like to post here is a more special situation.
This error occured while building a website in Visual Studio 2005 (the website was actually a port from an older Visual Studio 2005 WebSite Project). I could simply not find out why this error occured. It seemed that the compiler was building an object having a method or member with the same name as the class representing the page. In the codebehind file one could not pinpoint the problem, and then a coleague pointed out: “The form id has the same name as the class!”.
There you have it: in a ASP.Net 2.0 Website do not give the form object of a page the same id as the name of the page! otherwise you’ll get an error.



Entries (RSS)