Combine readonly and read only property : Properties : Class C# Examples


C# Examples » Class » Properties »

 

Combine readonly and read only property









    
using  System;

public  sealed  class  Value
{
        public  int  intValue  =  10;
}

public  sealed  class  MyController
{
        public  MyController(  Value  pimpl  )  {
                this.pimpl  =  pimpl;
        }

        public  int  IntValue  {
                get  {
                        return  pimpl.intValue;
                }
        }

        private  readonly  Value  pimpl;
}

public  sealed  class  MainClass
{
        static  void  Main()  {
                Value  someNumber  =  new  Value(  );
        }
}
    
   
  
   




HTML code for linking to this page:

Follow Navioo On Twitter

C# Examples

 Navioo Class
» Properties