Reference Static Field without Instance : Static field : Class C# Examples


C# Examples » Class » Static field »

 

Reference Static Field without Instance









    
using  System;

class  MyClass
{
      static  public  int  myStaticValue;
}

class  Program
{
      static  void  Main()
      {
            MyClass.myStaticValue  =  5;
            Console.WriteLine("myStaticValue  =  {0}",  MyClass.myStaticValue);
      }
}
    
   
  
   



Output

myStaticValue = 5


HTML code for linking to this page:

Follow Navioo On Twitter

C# Examples

 Navioo Class
» Static field