MatchTypes() 공개 메소드

Determines whether two types are considered equal according to their signature.
public MatchTypes ( ArrayTypeSignature signature1, ArrayTypeSignature signature2 ) : bool
signature1 AsmResolver.Net.Signatures.ArrayTypeSignature The first type to compare.
signature2 AsmResolver.Net.Signatures.ArrayTypeSignature The second type to compare.
리턴 bool
예제 #1
0
        public TypeDefinition ResolveType(ITypeDescriptor type)
        {
            if (type == null)
            {
                throw new ArgumentNullException("type");
            }
            type = type.GetElementType();

            var typeDef = type as TypeDefinition;

            if (typeDef != null)
            {
                return(typeDef);
            }

            var assemblyDescriptor = type.ResolutionScope.GetAssembly();

            if (assemblyDescriptor == null)
            {
                return((TypeDefinition)ThrowOrReturn(type));
            }

            var assembly = AssemblyResolver.ResolveAssembly(assemblyDescriptor);

            if (assembly == null)
            {
                return((TypeDefinition)ThrowOrReturn(type));
            }

            var typeDefTable = assembly.Header.GetStream <TableStream>().GetTable <TypeDefinition>();

            if (typeDefTable == null)
            {
                return((TypeDefinition)ThrowOrReturn(type));
            }

            var definition = typeDefTable.FirstOrDefault(x => _signatureComparer.MatchTypes(x, type));

            return(definition ?? (TypeDefinition)ThrowOrReturn(type));
        }