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); }
public T Create <T>() { ParameterGenerator.ClearRecursionControlList(); return((T)Create(typeof(T))); }