
Declare and use read write properties in C# Part 2 – Declare the properties
Now it’s time to declare the properties in the Person class.
public string Name
{
get
{
return _name;
}
set
{
_name = value;
}
}
public int Age
{
get
{
return _age;
}
set
{
_age = value;
}
}

There we go! Now in the last post we’ll create two instances of the Person class and set some values on our two objects.