Why can't I reference a static member from an inner class in C# ?
Posted
by asksuperuser
on Stack Overflow
See other posts from Stack Overflow
or by asksuperuser
Published on 2010-05-15T07:37:04Z
Indexed on
2010/05/15
7:44 UTC
Read the original article
Hit count: 162
c#
I have a static class
namespace MyNameSpace{
public static class MyStaticClass {
public static string myStaticMember = "";
}
}
I can reference myStaticMember in another class like this:
string varString = MyStaticClass.myStaticMember;
except if MyStaticClass is an inner class of the other class.
Why ?
© Stack Overflow or respective owner