How do we make a poperty read only? Private Property Get(Read Only )

Showing Answers 1 - 6 of 6 Answers

sridhar

  • Nov 14th, 2006
 

Property can be made readonly by using "readonly" keyword with it.

such properties dont have set method ,only get method is applicable in this case.

  Was this answer useful?  Yes

ashrafali_002

  • Jun 11th, 2007
 

To make property read only

I want make a property readonly for FirstName(string)

public string FirstName
{
      get{return _firstName;}
      //Not apply set code here
}


This method is readonly property of FirstName.

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions