Esempio n. 1
0
        public static Settable<T> New(T value, bool isSet)
        {
            var output = new Settable<T>
            {
                zValue = value,
                IsSet = isSet
            };

            return output;
        }
Esempio n. 2
0
        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;
        }
Esempio n. 3
0
 public static void CloneFrom <T>(this Settable <T> settable, Settable <T> other)
 {
     if (other.IsSet)
     {
         settable.Value = other.Value;
     }
     else
     {
         settable.Unset();
     }
 }
Esempio n. 4
0
        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;
            }
        }