public UserDefinedTypeExporter(System.Type type) { RealTypeName = UserDefinedTypeSupport.GetTypeName(type); RealType = type; var fields = UserDefinedTypeSupport.GetFields(RealType); var properties = UserDefinedTypeSupport.GetProperties(RealType); var count = fields.Count + properties.Count; Names = new string[count]; Getters = new GetterDelegate[count]; int i = 0; while (i < fields.Count) { var fieldData = fields[i]; Names[i] = fieldData.Name; Getters[i] = CreateGetter(type, fieldData.Member); ++i; } while (i < count) { var propertyData = properties[i - fields.Count]; Names[i] = propertyData.Name; Getters[i] = CreateGetter(type, propertyData.Member); ++i; } }
public UserDefinedTypeImporter(System.Type realType) { RealType = realType; RealTypeName = UserDefinedTypeSupport.GetTypeName(realType); var fields = realType.GetFields(); var properties = realType.GetProperties(); FieldSetters = new System.Collections.Generic.Dictionary <string, SetterDelegate>(fields.Length + properties.Length + 1); FieldSetters["__Type"] = this.CheckType; foreach (var field in UserDefinedTypeSupport.GetFields(RealType)) { FieldSetters[field.Name] = CreateFieldSetter(realType, field.Member); } foreach (var property in UserDefinedTypeSupport.GetProperties(RealType)) { FieldSetters[property.Name] = CreatePropertySetter(realType, property.Member); } }