System.IComparable.CompareTo(TSource)

Here are the examples of the csharp api System.IComparable.CompareTo(TSource) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

3 Examples 7

19 Source : Data.cs
with GNU General Public License v3.0
from GilbertoGojira

public int CompareTo(DataWithEnreplacedy<TSource> other) {
      return Value.CompareTo(other.Value);
    }

19 Source : Data.cs
with GNU General Public License v3.0
from GilbertoGojira

public int CompareTo(DataWithIndex<TSource> other) {
      return Value.CompareTo(other.Value);
    }

19 Source : LinqExtensions.cs
with Apache License 2.0
from ProteoWizard

public static int SequenceCompareTo<TSource>(this IEnumerable<TSource> first, IEnumerable<TSource> second) where TSource : IComparable<TSource>
        {
            using (var itr1 = first.GetEnumerator())
            using (var itr2 = second.GetEnumerator())
            {
                while (true)
                {
                    bool itr1Valid = itr1.MoveNext();
                    bool itr2Valid = itr2.MoveNext();

                    if (!itr1Valid || !itr2Valid)
                    {
                        if (itr1Valid)
                        {
                            return 1;
                        }
                        if (itr2Valid)
                        {
                            return -1;
                        }
                        return 0;
                    }
                    int result;
                    if (itr1.Current == null)
                    {
                        result = itr2.Current == null ? 0 : -itr2.Current.CompareTo(itr1.Current);
                    }
                    else
                    {
                        result = itr1.Current.CompareTo(itr2.Current);
                    }
                    if (result != 0)
                        return result;
                }
            }
        }