Exemplo n.º 1
0
        public static Type EmitType(Type typeToMake, BaseClassEmitter emitterToUse, string nameForClass = null)
        {
            var modelBuilder = GetModelBuilder();

            if (!typeToMake.IsInterface)
            {
                throw new ArgumentException($"Parameter must be type of an interface", nameof(typeToMake));
            }
            if (typeToMake.GetMethods().Any(m => !m.IsHideBySig))
            {
                throw new ArgumentException("Parameter must be of an interface type that does contain methods.",
                                            nameof(typeToMake));
            }

            return(emitterToUse.EmitType(modelBuilder, typeToMake, nameForClass));
        }
Exemplo n.º 2
0
 private static IEnumerable <Tuple <Type, Type> > EmitTypes(BaseClassEmitter emitterToUse, ModuleBuilder modelBuilder, Type[] typesToMake)
 => typesToMake.Select(x => new Tuple <Type, Type>(x, emitterToUse.EmitType(modelBuilder, x)));