Beispiel #1
0
 // [IComparable<LanguageItem>]
 /// <summary>
 /// Facilitates ordering of language items to match their order in a source language list.
 /// Quality value is given precendence (higher sorts before lower value), but where that is equal,
 /// we fallback on Ordinal (lower sorts before higher value).
 /// </summary>
 /// <param name="other"></param>
 /// <returns></returns>
 public int CompareTo(LanguageItem other)
 {
     return(Quality != other.Quality ? (Quality > other.Quality ? -1 : 1):
            Ordinal != other.Ordinal ? (Ordinal < other.Ordinal ? -1 : 1):
            string.Compare(
                LanguageTag != null ?       LanguageTag.ToString() : "",
                other.LanguageTag != null ? other.LanguageTag.ToString() : "",
                true));
 }
Beispiel #2
0
 // [IComparable<ILanguageTag>]
 public int CompareTo(ILanguageTag other)
 {
     return(string.Compare(m_langtag, other.ToString(), true));
 }
Beispiel #3
0
 // [IEquatable<ILanguageTag>]
 public bool Equals(ILanguageTag other)
 {
     return(0 == string.Compare(m_langtag, other.ToString(), true));
 }
Beispiel #4
0
 // [IComparable<ILanguageTag>]
 /// <summary>
 /// CompareTo
 /// </summary>
 /// <param name="other"></param>
 /// <returns></returns>
 public int CompareTo(ILanguageTag other)
 {
     return(string.Compare(OriginalLanguageTag, other.ToString(), StringComparison.OrdinalIgnoreCase));
 }
Beispiel #5
0
 // [IEquatable<ILanguageTag>]
 /// <summary>
 /// Equals
 /// </summary>
 /// <param name="other"></param>
 /// <returns></returns>
 public bool Equals(ILanguageTag other)
 {
     return(0 == string.Compare(OriginalLanguageTag, other.ToString(), StringComparison.OrdinalIgnoreCase));
 }