Yep! That's it in a nutshell! =)
If you only have a get without a set, then the Property is read-only. You can also use the set to do other things besides set the value of m_MyProperty.
~~Bonnie
>Bonnie,
>
>I understand the purpose of a Property. You know, I was just typing you a long reply of what I didn't understand and as I was trying to explain, I finally got it (I think <g>).
>
>Here is what I misunderstood before and do now. I was not understanding the use of private string m_MyProperty. And I know I see that it (the property m_MyProperty) holds the value
used by my class. The property MyProperty is simply a way to pass the value to m_MyProperty and get it back to the outside world. Am I correct in understanding it?
>
>Thank you.
>
>>Dmitry,
>>
>>Sometimes it is sufficient simply to have a public field, but this doesn't always work for everything.
>>
>>The Get/Set methods are basically what makes it a Property. In order for stuff to show up on Property Sheets, they need to be specifically defined as a Property. Some other things also require Properties (DataBinding in WinForms is one good example).
>>
>>private string m_MyProperty;
>>
>>public string MyProperty
>>{
>> get {return this.m_MyProperty;}
>> set {this.m_MyProperty = value;}
>>}
>>
>>Your book will probably do a better job of explaining Properties <g> but I thought I'd just give you a brief description anyway.
>>
>>~~Bonnie
>>