/// <inheritdoc />
        public bool Equals(TypeSignature x, TypeSignature y)
        {
            if (ReferenceEquals(x, y))
            {
                return(true);
            }
            if (ReferenceEquals(x, null) || ReferenceEquals(y, null))
            {
                return(false);
            }

            return(x switch
            {
                CorLibTypeSignature corLibType => Equals(corLibType, y as CorLibTypeSignature),
                TypeDefOrRefSignature typeDefOrRef => Equals(typeDefOrRef, y as TypeDefOrRefSignature),
                SzArrayTypeSignature szArrayType => Equals(szArrayType, y as SzArrayTypeSignature),
                ArrayTypeSignature arrayType => Equals(arrayType, y as ArrayTypeSignature),
                ByReferenceTypeSignature byRefType => Equals(byRefType, y as ByReferenceTypeSignature),
                BoxedTypeSignature boxedType => Equals(boxedType, y as BoxedTypeSignature),
                GenericInstanceTypeSignature genericInstanceType => Equals(genericInstanceType, y as GenericInstanceTypeSignature),
                GenericParameterSignature genericParameter => Equals(genericParameter, y as GenericParameterSignature),
                PointerTypeSignature pointerType => Equals(pointerType, y as PointerTypeSignature),
                PinnedTypeSignature pinnedType => Equals(pinnedType, y as PinnedTypeSignature),
                CustomModifierTypeSignature modifierType => Equals(modifierType, y as CustomModifierTypeSignature),
                _ => throw new NotSupportedException()
            });
Example #2
0
        /// <summary>
        /// Determines whether two types are considered equal according to their signature.
        /// </summary>
        /// <param name="signature1">The first type to compare.</param>
        /// <param name="signature2">The second type to compare.</param>
        /// <returns><c>True</c> if the types are considered equal, <c>False</c> otherwise.</returns>
        public bool Equals(PinnedTypeSignature signature1, PinnedTypeSignature signature2)
        {
            if (signature1 == null && signature2 == null)
            {
                return(true);
            }
            if (signature1 == null || signature2 == null)
            {
                return(false);
            }

            return(Equals(signature1.BaseType, signature2.BaseType));
        }
Example #3
0
 private PinnedTypeSignature ImportPinnedTypeSignature(PinnedTypeSignature pinnedType)
 {
     return(new PinnedTypeSignature(ImportTypeSignature(pinnedType.BaseType)));
 }
Example #4
0
 /// <inheritdoc />
 public int GetHashCode(PinnedTypeSignature obj) =>
 GetHashCode(obj as TypeSpecificationSignature);
Example #5
0
 /// <inheritdoc />
 public bool Equals(PinnedTypeSignature x, PinnedTypeSignature y) =>
 Equals(x as TypeSpecificationSignature, y);
Example #6
0
 /// <inheritdoc />
 public object VisitPinnedType(PinnedTypeSignature signature) => throw new NotSupportedException();
Example #7
0
 /// <inheritdoc />
 public TypeMemoryLayout VisitPinnedType(PinnedTypeSignature signature) =>
 new TypeMemoryLayout(signature, PointerSize);