Monday, May 2, 2011

readonly properties

There is nothing like readonly properties because readonly keyword is applied only to field members. and readonly members are initialized only in the constructors.

We can have properties which has only get block and no set block which allows only to return the values but not set or assign the value.

private int _i=5;
public int i //this property allows to get the value of _i variable but we cant set the value of _i.
      return _i;

No comments:

Post a Comment