Beispiel #1
0
        protected TypeReference GetTypeReference(System.Type type)
        {
            string fullName = type.GetCecilFullname();

            TypeDefinition typeDefinition = ModuleDefinition.GetType(fullName);

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

            TypeReference typeReference;

            if (!ModuleDefinition.TryGetTypeReference(fullName, out typeReference))
            {
                typeReference = ModuleDefinition.Import(type);
            }

            return(typeReference);
        }