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); }
public IPalasoDataObjectProperty Clone() { var clone = new OptionRef(Key); clone.EmbeddedXmlElements = new List <string>(EmbeddedXmlElements); clone.Annotation = Annotation == null ? null : Annotation.Clone(); return(clone); }
/// <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); }
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); }