Exemplo n.º 1
0
                public SystemImport(Func <string, TypeDefinition> findType, ModuleDefinition moduleDefinition)
                {
                    Action      = new ActionImport(findType, moduleDefinition);
                    Type        = new TypeImport(findType, moduleDefinition);
                    Collections = new CollectionsImport(findType, moduleDefinition);

                    IServiceProvider = moduleDefinition.ImportReference(findType("System.IServiceProvider"));
                    Exception        = moduleDefinition.ImportReference(findType("System.Exception"));

                    var aggregateExceptionType = findType("System.AggregateException");
                    var enumerableException    = Collections.Enumerable.MakeGenericInstanceType(Exception);

                    AggregateException_Ctor = moduleDefinition.ImportReference(aggregateExceptionType
                                                                               .GetConstructors().Single(c =>
                                                                                                         c.Parameters.Count == 2 &&
                                                                                                         c.Parameters[0].ParameterType.IsType <string>() &&
                                                                                                         c.Parameters[1].ParameterType.IsType(enumerableException)));

                    Func2_Ctor =
                        moduleDefinition.ImportReference(findType("System.Func`2")).Resolve().GetConstructors().Single();
                }
Exemplo n.º 2
0
 public ActionAll()
 {
     ActionImport = new ActionImport();
     ActionExport = new ActionExport();
 }