Esempio n. 1
0
 public bool Equals(OptionRef other)
 {
     if (ReferenceEquals(null, other))
     {
         return(false);
     }
     if (ReferenceEquals(this, other))
     {
         return(true);
     }
     if (Key != other.Key)
     {
         return(false);
     }
     //we are doing a reference comparison here in case it's null
     if ((_annotation != null && !_annotation.Equals(other._annotation)) || (other._annotation != null && !other._annotation.Equals(_annotation)))
     {
         return(false);
     }
     if (!EmbeddedXmlElements.SequenceEqual(other.EmbeddedXmlElements))
     {
         return(false);
     }
     return(true);
 }
Esempio n. 2
0
        public IPalasoDataObjectProperty Clone()
        {
            var clone = new OptionRef(Key);

            clone.EmbeddedXmlElements = new List <string>(EmbeddedXmlElements);
            clone._annotation         = _annotation == null ? null : _annotation.Clone();
            return(clone);
        }
Esempio n. 3
0
        /// <summary>
        /// Removes a key from the OptionRefCollection
        /// </summary>
        /// <param name="key">The OptionRef key to be removed</param>
        /// <returns>true when removed, false when doesn't already exists in collection</returns>
        public bool Remove(string key)
        {
            OptionRef or = FindByKey(key);

            if (or != null)
            {
                _members.Remove(or);
                NotifyPropertyChanged();
                return(true);
            }
            return(false);
        }
Esempio n. 4
0
        public int CompareTo(object obj)
        {
            if (obj == null)
            {
                return(1);
            }
            if (!(obj is OptionRef))
            {
                throw new ArgumentException("Can not compare to anythiong but OptionRefs.");
            }
            OptionRef other = (OptionRef)obj;
            int       order = Key.CompareTo(other.Key);

            return(order);
        }