Read-only Properties

You can also create read-only properties if you omit the set accessor method. For example, to make the Name property a read-only property, you use this code:

 
 class Customer {   private string name;  public string Name   {   get   {   return name;   }   }  } 


Microsoft Visual C#. NET 2003 Kick Start
Microsoft Visual C#.NET 2003 Kick Start
ISBN: 0672325470
EAN: 2147483647
Year: 2002
Pages: 181

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net