Пример #1
0
        public bool Equals(ITypeMemberReference?x, ITypeMemberReference?y)
        {
            if (x == y)
            {
                return(true);
            }
            RoslynDebug.Assert(x is object && y is object);

            if (
                x.GetContainingType(_metadataWriter.Context)
                != y.GetContainingType(_metadataWriter.Context)
                )
            {
                if (
                    _metadataWriter.GetMemberReferenceParent(x)
                    != _metadataWriter.GetMemberReferenceParent(y)
                    )
                {
                    return(false);
                }
            }

            if (x.Name != y.Name)
            {
                return(false);
            }

            var xf = x as IFieldReference;
            var yf = y as IFieldReference;

            if (xf != null && yf != null)
            {
                return(_metadataWriter.GetFieldSignatureIndex(xf)
                       == _metadataWriter.GetFieldSignatureIndex(yf));
            }

            var xm = x as IMethodReference;
            var ym = y as IMethodReference;

            if (xm != null && ym != null)
            {
                return(_metadataWriter.GetMethodSignatureHandle(xm)
                       == _metadataWriter.GetMethodSignatureHandle(ym));
            }

            return(false);
        }
Пример #2
0
        public bool Equals(ITypeMemberReference x, ITypeMemberReference y)
        {
            if (x == y)
            {
                return(true);
            }

            if (x.GetContainingType(_metadataWriter.Context) != y.GetContainingType(_metadataWriter.Context))
            {
                if (_metadataWriter.GetMemberRefParentCodedIndex(x) != _metadataWriter.GetMemberRefParentCodedIndex(y))
                {
                    return(false);
                }
            }

            if (x.Name != y.Name)
            {
                return(false);
            }

            IFieldReference /*?*/ xf = x as IFieldReference;
            IFieldReference /*?*/ yf = y as IFieldReference;

            if (xf != null && yf != null)
            {
                return(_metadataWriter.GetFieldSignatureIndex(xf) == _metadataWriter.GetFieldSignatureIndex(yf));
            }

            IMethodReference /*?*/ xm = x as IMethodReference;
            IMethodReference /*?*/ ym = y as IMethodReference;

            if (xm != null && ym != null)
            {
                return(_metadataWriter.GetMethodSignatureIndex(xm) == _metadataWriter.GetMethodSignatureIndex(ym));
            }

            return(false);
        }