Example #1
0
        public TypeReferenceProvider(ModuleDefinition moduleDefinition, TypeProvider typeProvider)
        {
            ConfiguredTaskAwaitableReference =
                moduleDefinition.ImportReference(typeProvider.ConfiguredTaskAwaitableDefinition);
            ConfiguredTaskAwaiterReference =
                moduleDefinition.ImportReference(typeProvider.ConfiguredTaskAwaiterDefinition);

            GenericConfiguredTaskAwaitableReference =
                moduleDefinition.ImportReference(typeProvider.GenericConfiguredTaskAwaitableDefinition);
            GenericConfiguredTaskAwaiterReference =
                moduleDefinition.ImportReference(typeProvider.GenericConfiguredTaskAwaiterDefinition);

            TaskConfigureAwaitMethodReference =
                moduleDefinition.ImportReference(typeProvider.TaskConfigureAwaitMethodDefinition);
            GenericTaskReference = moduleDefinition.ImportReference(typeProvider.GenericTaskDefinition);
            GenericTaskConfigureAwaitMethodReference =
                moduleDefinition.ImportReference(typeProvider.GenericTaskConfigureAwaitMethodDefinition);
        }
        public AsyncIlHelper(TypeProvider typeProvider, TypeReferenceProvider typeReferenceProvider,
                             ModuleDefinition moduleDefinition)
        {
            _moduleDefinition = moduleDefinition;

            //Awaitable
            _configuredTaskAwaitableTypeRef = typeReferenceProvider.ConfiguredTaskAwaitableReference;
            _configuredTaskAwaitableType    = typeProvider.ConfiguredTaskAwaitableDefinition;

            _configuredTaskAwaiterTypeRef = typeReferenceProvider.ConfiguredTaskAwaiterReference;
            _configuredTaskAwaiterType    = typeProvider.ConfiguredTaskAwaiterDefinition;

            _genericConfiguredTaskAwaitableType = typeProvider.GenericConfiguredTaskAwaitableDefinition;
            _genericConfiguredTaskAwaiterType   = typeProvider.GenericConfiguredTaskAwaiterDefinition;

            _taskConfigureAwaitMethod = typeReferenceProvider.TaskConfigureAwaitMethodReference;

            _genericTaskType = typeProvider.GenericTaskDefinition;
            _genericTaskConfigureAwaitMethod = typeProvider.GenericTaskConfigureAwaitMethodDefinition;
        }