/// <summary> /// Compares two specified types for order. Returns a negative integer, zero, or a positive integer /// as this object is less than, equal to, or greater than the specified object. /// <p> /// Unlike natual ordering of {@link InstrumentProfileType} enum itself this method supports /// unknown types and orders them alphabetically after standard ones. /// <p> /// The natural ordering implied by this method is designed for convenient data representation /// in a file and shall not be used for business purposes. /// </summary> /// <param name="type1">First type to compare.</param> /// <param name="type2">Second type to compare.</param> /// <returns></returns> /// <exception cref="System.ArgumentNullException"></exception> public static int CompareTypes(string type1, string type2) { InstrumentProfileType t1 = Find(type1); InstrumentProfileType t2 = Find(type2); if (t1 == null) { return(t2 == null?type1.CompareTo(type2) : +1); } if (t2 == null) { return(-1); } return(t1.CompareTo(t2)); }
/// <summary> /// Compare this type with other. /// </summary> /// <param name="other">Other type to compare.</param> /// <returns></returns> public int CompareTo(InstrumentProfileType other) { return(Name.CompareTo(other.Name)); }