Use Properties to get and set private member variable : Private : Class C# Examples


C# Examples » Class » Private »

 

Use Properties to get and set private member variable









    
using  System;

class  Circle{
        int  radius;
        
        public  int  Radius{
                get{
                        return(radius);
                }
                set{
                        radius  =  value;
                }
        }

}
class  MainClass
{
        public  static  void  Main()
        {
                Circle  c  =  new  Circle();
                c.Radius  =  35;
        }
}
    
   
  
   




HTML code for linking to this page:

Follow Navioo On Twitter

C# Examples

 Navioo Class
» Private