Ejemplo n.º 1
0
        public object CreateByFieldsAndProperties(Type t)
        {
            object              res                = Activator.CreateInstance(t);
            List <FieldInfo>    fields             = ClassInfo.GetClassFieldsInfo(t);
            List <PropertyInfo> settableProperties = PropertiesInfoProcessor.GetSettableProperties(ClassInfo.GetClassPropertiesInfo(t));

            foreach (FieldInfo field in fields)
            {
                field.SetValue(res, ParameterGenerator.Generate(field.FieldType));
            }

            foreach (PropertyInfo property in settableProperties)
            {
                property.SetValue(res, ParameterGenerator.Generate(property.PropertyType));
            }

            return(res);
        }
Ejemplo n.º 2
0
 public T Create <T>()
 {
     ParameterGenerator.ClearRecursionControlList();
     return((T)Create(typeof(T)));
 }