Home > Articles > Software Development & Management > Object Technology

  • Print
  • + Share This
This chapter is from the book

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; 
  }
 }
}
  • + Share This
  • 🔖 Save To Your Account