c# set value in getter code example
Example 1: getter setter c#
class Student
{
public int Age { get; set; }
}
Example 2: get setter c# model
Person person = new Person();
person.Name = "Joe"; // the set accessor is invoked here
System.Console.Write(person.Name); // the get accessor is invoked here