When i make a nested class and name it B and make a variable called B, and when i try to work with it with a "this." then there stand its Ambiguous.
Shouldn't it be a bug since whenever you write "this." its obviously a variable you are trying to work with and not the class.
When i put the B class outside the A class, then it works, so i cant really see the reason why the c# creators would make it ambiguous just because its nested.
You cannot have a nested type and a member with the same name at all.
Even if you don't use B
anywhere, your code will not compile.
Types and members within a class share the naming scope, and thus cannot share names.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.