I have the following class:
public abstract class AuditableTable : TableServiceEntity, IAuditableTable
{
protected AuditableTable()
: base()
{
Status = "3";
}
protected AuditableTable(string pk, string rk)
: base(pk, rk)
{
}
public string Status { get; set; }
Is there a simple way that I can make the value of Status always default to “3” when a new instance is created? What is the way that most people use?
Update
I added a setter but then it will not set if the other constructor is called.
Do not use auto-implemented property. Declare a private field with initial value.
EDIT: Assign property value in constructor is good practice but if that class has more than one constructors than I think it will be good to initialize member at declaration.