public int CompareTo(CustomInfo other) { if (items == null && other.items == null) { return(0); } if (items == null) { return(-1); } if (other.items == null) { return(1); } if (!items.Count.Equals(other.items.Count)) { return(items.Count.CompareTo(other.items.Count)); } for (int a = 0; a < items.Count; a++) { CustomInfoItem cii1 = items[a]; CustomInfoItem cii2 = other.items[a]; if (!cii1.Equals(cii2)) { return(cii1.CompareTo(cii2)); } } return(0); }
/// <summary> /// Removes custom item /// </summary> /// <param name="Name">item name</param> public void Remove(string Name) { CustomInfoItem customInfoItem = items.FirstOrDefault(c => c.Name == Name); if (customInfoItem != null) { items.Remove(customInfoItem); if (CollectionChanged != null) { CollectionChanged(); } } }
/// <summary> /// Gets or sets item value based on provided item name /// </summary> /// <param name="name">item name</param> /// <returns>item value</returns> public string this[string name] { get { CustomInfoItem customInfoItem = items.FirstOrDefault(c => c.Name == name); if (customInfoItem != null) { return(customInfoItem.Value); } else { return(null); } } set { Add(name, value); } }