im now learning how to use properties in C# Windows Form.
one thing that strikes me is there the below example is a property BUT there is no mention of the word property when declaring it?
is it really this simple? seems to simple to be true, i expected a bit more to properties as ive seen with other languages.
public string Name
{
get
{
return myName;
}
set
{
myName = value;
}
}
Can a property be so simple? is this correct?
4 Answers
Know the answer? Post it. Somebody with the same question will find it here.

Santhosh NRank #4,788 · 325 reputationPosted Dec 21, 2010, 3:00 AM EST
string myName;
public string Name
{
get
{
return myName;
}
set
{
myName = value;
}
}
Santhosh NRank #4,788 · 325 reputationPosted Dec 21, 2010, 2:37 AM EST
and to make them readonly you can remove set method and to make it writeonly you can remove get method in that..
John Burns116 reputationPosted Dec 21, 2010, 2:41 AM EST
John Burns116 reputationPosted Dec 21, 2010, 2:54 AM EST