Example #1
0
            public int Compare(IMethodInformation x, IMethodInformation y)
            {
                var rn = x.Name.CompareTo(y.Name);

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

                var xps = x.Parameters;
                var yps = y.Parameters;

                rn = xps.Length.CompareTo(yps.Length);
                if (rn != 0)
                {
                    return(rn);
                }

                // The arg0 type for virtual method has to ignore different types.
                return(xps.
                       Zip(yps, (xp, yp) => new { xp, yp }).
                       Select((entry, index) =>
                              (isVirtual && (index == 0)) ? 0 : MethodSignatureParameterComparer.Compare(entry.xp, entry.yp)).
                       FirstOrDefault(r => r != 0));
            }
Example #2
0
            public bool Equals(IMethodInformation x, IMethodInformation y)
            {
                if (x.Name != y.Name)
                {
                    return(false);
                }

                var xps = x.Parameters;
                var yps = y.Parameters;

                if (xps.Length != yps.Length)
                {
                    return(false);
                }

                // The arg0 type for virtual method has to ignore different types.
                return(xps.
                       Zip(yps, (xp, yp) => new { xp, yp }).
                       Select((entry, index) =>
                              (isVirtual && (index == 0)) ? true : MethodSignatureParameterComparer.Equals(entry.xp, entry.yp)).
                       FirstOrDefault(r => r));
            }