C# properties: how to use custom set property without private field?
Once you want to do anything custom in either the getter or the setter you cannot use auto properties anymore.
You can try something like this:
public string Name { get; private set; }
public void SetName(string value)
{
DoSomething();
this.Name = value;
}
This is not possible. Either auto implemented properties or custom code.