public static Settable<T> New(T value, bool isSet) { var output = new Settable<T> { zValue = value, IsSet = isSet }; return output; }
public bool Equals(Settable<T> other) { if(other == null) // Skip exact type check since Settable is sealed, so no need to handle descendent types. { return false; } var isEqual = this.Equals_Value(other); return isEqual; }
public static void CloneFrom <T>(this Settable <T> settable, Settable <T> other) { if (other.IsSet) { settable.Value = other.Value; } else { settable.Unset(); } }
private bool Equals_Value(Settable<T> other) { // First compare whether the settables are both set. var isSetIsEqual = this.IsSet == other.IsSet; if(!isSetIsEqual) { return false; } if(this.Value is object) { var isEqual = this.Value.Equals(other.Value); return isEqual; } else { var isEqual = !(other.Value is object); return isEqual; } }