Conflict between instance and class properties with the same name
I don’t know, maybe I’m missing something or maybe I’m just stupid (you can pick, just let me know):
class User
{
public static readonly int ID; // class property
public int ID; // instance property
}
Compiling this little cutie returns the error:
“ The type ‘ConsoleApplication1.User’ already contains a definition for ‘ID’ “
What’s going on here ? This properties are completely different, one is *instance* property and the other is *class* property. What is the conflict here? Am I missing some Microsoft spec on this one? Am I missing some OOP lesson? Is it C# restriction? Is it CLI restriction ?
I’m confused…