C# class property is set by get, set keywords, and provides convenient way to set and get the property values.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
class human { public int age; public string sex; public human(int a, string s) {age=a;sex=s;} public string isex { get { return sex; } set { sex = value; } } }
1 2 3
human chris = new human(23,"female"); chris.isex; //female chris.isex = "male"; //chris's sex is now male