コード例 #1
0
ファイル: SiloAddress.cs プロジェクト: RIntegerB2B/orleans-1
        public int CompareTo(SiloAddress other)
        {
            if (other == null)
            {
                return(1);
            }
            // Compare Generation first. It gives a cheap and fast way to compare, avoiding allocations
            // and is also semantically meaningfull - older silos (with smaller Generation) will appear first in the comparison order.
            // Only if Generations are the same, go on to compare Ports and IPAddress (which is more expansive to compare).
            // Alternatively, we could compare ConsistentHashCode or UniformHashCode.
            int comp = Generation.CompareTo(other.Generation);

            if (comp != 0)
            {
                return(comp);
            }

            comp = Endpoint.Port.CompareTo(other.Endpoint.Port);
            if (comp != 0)
            {
                return(comp);
            }

            return(CompareIpAddresses(Endpoint.Address, other.Endpoint.Address));
        }
コード例 #2
0
 public int CompareTo(SiloAddress other)
 {
     return(other == null ? 1 : Generation.CompareTo(other.Generation));
 }