ReadOnly property in C#.NET / ASP.Net C#

Properties can be made read-only by having only a get accessor in the implementation.

public class X
{

          public X(int id)
          {
               _id = id;
          }

          public int ID
          {
              get
              {
                   return_id;
              }
          }

}
Tags:
Hot on Web:


About author