-2

I have a class Defined as follows:

class Foo
    {
        internal string IString;
        internal static string IstaticString;
        public Foo()
        {
            IstaticString = "static";
            IString = "non - static";
        }
    }

i am creating it's instance in the main function as like the following, in this time IString is accessible through the object where as IstaticString is not accessible. can any one explain the reason for this?

enter image description here

sujith karivelil
  • 27,818
  • 6
  • 51
  • 82

2 Answers2

2

static members are not accessible from instances. Foo.IstaticString should work

ASh
  • 32,398
  • 9
  • 53
  • 74
0

Static fields accessible from type not from instance. This Foo.IstaticString should work