Exemple #1
0
        public DmdEventDefCOMD(DmdComMetadataReader reader, uint rid, DmdType declaringType, DmdType reflectedType) : base(rid, declaringType, reflectedType)
        {
            this.reader = reader ?? throw new ArgumentNullException(nameof(reader));
            reader.Dispatcher.VerifyAccess();
            uint token = 0x14000000 + rid;

            Name       = MDAPI.GetEventName(reader.MetaDataImport, token) ?? string.Empty;
            Attributes = MDAPI.GetEventAttributes(reader.MetaDataImport, token);
            var eventTypeToken = MDAPI.GetEventTypeToken(reader.MetaDataImport, token);

            EventHandlerType = reader.ResolveType((int)eventTypeToken, DeclaringType !.GetGenericArguments(), null, DmdResolveOptions.None) ?? reader.Module.AppDomain.System_Void;
        }
Exemple #2
0
        DmdType[] ReadDeclaredInterfacesCore_COMThread(IList <DmdType> genericTypeArguments)
        {
            reader.Dispatcher.VerifyAccess();
            var tokens = MDAPI.GetInterfaceImplTokens(reader.MetaDataImport, (uint)MetadataToken);

            if (tokens.Length == 0)
            {
                return(null);
            }
            var res = new DmdType[tokens.Length];

            for (int i = 0; i < res.Length; i++)
            {
                uint token      = tokens[i];
                uint ifaceToken = MDAPI.GetInterfaceImplInterfaceToken(reader.MetaDataImport, token);
                res[i] = reader.ResolveType((int)ifaceToken, genericTypeArguments, null, DmdResolveOptions.ThrowOnError);
            }
            return(res);
        }