Пример #1
0
        public override bool Equals(object obj)
        {
            // Named item - compare values
            NamedItem <T> asNamedItem = obj as NamedItem <T>;

            if (asNamedItem != null)
            {
                if (this.Value == null)
                {
                    return(asNamedItem.Value == null);
                }

                return(this.Value.Equals(asNamedItem.Value));
            }

            // Direct value - compare to my value
            if (this.Value == null)
            {
                return(obj == null);
            }
            else
            {
                return(this.Value.Equals(obj));
            }
        }
Пример #2
0
        internal static T Extract(object p)
        {
            NamedItem <T> v = p as NamedItem <T>;

            if (v == null)
            {
                return(default(T));
            }

            return(v.Value);
        }
Пример #3
0
 public int CompareTo(NamedItem <T> other)
 {
     return(StringHelper.StrCmpLogicalW(this.DisplayName, other?.DisplayName));
 }