[Solved] How to retain old value when setting variable on c# class


One way to do it would be to have a new property on your myClass

public class myClass
{
    private string _setString;
    public string setString 
    {
            get
            {
                 return _setString;
             }
            set
            {
                 AuditTrail +=  value;
                 _setString = value;
            }
    }

    public string AuditTrail{get;set;}

}

Then in your main method you’d put:

Console.WriteLine(AuditTrail);

0

solved How to retain old value when setting variable on c# class