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;
}
}
Loading
Santhosh NPosted Dec 21, 2010, 8:00 AM
string myName;
public string Name
{
get
{
return myName;
}
set
{
myName = value;
}
}
John BurnsPosted Dec 21, 2010, 7:54 AM
John BurnsPosted Dec 21, 2010, 7:41 AM
Santhosh NPosted Dec 21, 2010, 7:37 AM
and to make them readonly you can remove set method and to make it writeonly you can remove get method in that..