Example #1
0
        public static TypeInfo CompileResultTypeInfo(DynamicObject dynamicObject)
        {
            TypeBuilder        tb          = GetTypeBuilder(dynamicObject.Name);
            ConstructorBuilder constructor = tb.DefineDefaultConstructor(MethodAttributes.Public | MethodAttributes.SpecialName | MethodAttributes.RTSpecialName);

            foreach (Field field in dynamicObject.Fields)
            {
                CreateProperty(tb, field);
            }

            TypeInfo objectTypeInfo = tb.CreateTypeInfo();

            return(objectTypeInfo);
        }
Example #2
0
 private void CreateType(DynamicObject dynamicObject)
 {
     var myTypeInfo = CompileResultTypeInfo(dynamicObject);
     var myType     = myTypeInfo.AsType();
 }