public FieldDescription(TypeDescription typeDescription, FieldInfo fieldInfo) : base(typeDescription, fieldInfo) { if (fieldInfo == null) { throw new ArgumentNullException("fieldInfo"); } this.fieldInfo = fieldInfo; GettersAndSetters.TryGetAssessors(fieldInfo, out this.getFn, out this.setFn); }
public PropertyDescription(TypeDescription typeDescription, PropertyInfo propertyInfo) : base(typeDescription, propertyInfo) { if (propertyInfo == null) { throw new ArgumentNullException("propertyInfo"); } this.propertyInfo = propertyInfo; this.getMethod = propertyInfo.GetGetMethod(nonPublic: true); this.setMethod = propertyInfo.GetSetMethod(nonPublic: true); GettersAndSetters.TryGetAssessors(this.getMethod, this.setMethod, out this.getFn, out this.setFn); }
public TypeDescription(Type objectType) : base(objectType) { if (objectType == null) { throw new ArgumentNullException("objectType"); } this.objectType = objectType; var members = FindMembers(objectType); this.members = members.AsReadOnly(); this.membersByName = members.ToDictionary(m => m.Name); GettersAndSetters.TryGetConstructor(objectType, out this.constructorFn); }
public TypeDescription(Type objectType) : base(null, objectType) { if (objectType == null) { throw new ArgumentNullException("objectType"); } this.objectType = objectType; this.IsDataContract = this.Attributes.Any(attribute => attribute.GetType().Name == DATA_CONTRACT_ATTRIBUTE_NAME); this.IsSerializable = IsSerializable; this.IsAnonymousType = objectType.IsSealed && objectType.IsNotPublic && objectType.GetCustomAttributes(typeof(CompilerGeneratedAttribute), true).Length > 0;; var allMembers = this.FindMembers(objectType); this.members = allMembers.AsReadOnly(); this.membersByName = allMembers.ToDictionary(m => m.Name, StringComparer.Ordinal); GettersAndSetters.TryGetConstructor(objectType, out this.constructorFn); }