ReadOnly Get and private Set propertie?

  • Thread starter Thread starter Norton
  • Start date Start date
N

Norton

Is it possible to have a property that is Public read only and private
writable? What would the syntax look like?

Thanks.

NortonZ
 
Current .NET versions do not support it. But, it is in .NET 2.0!

Is it possible to have a property that is Public read only and private
writable? What would the syntax look like?

Thanks.

NortonZ
 
How about this...?

class MyClass
{
public int Value { get{ return value; } } // readonly property
private int value; // private variable
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top