public IEnumerable <PropertyDescriptor> Select(PropertyWriterArgs args) { return(args .TargetType .GetProperties(BindingFlags.Public | BindingFlags.Instance) .Where(prop => prop.CanWrite) .Select(prop => new PrivateSetterDescriptor(prop))); }
public IEnumerable <PropertyDescriptor> Select(PropertyWriterArgs args) { var targetType = args.TargetType; var properties = targetType.GetProperties(PropertyBindingFlags); var descriptors = new List <PropertyDescriptor>(properties.Length); foreach (var property in properties) { var field = targetType.GetField("_" + property.Name, FieldBindingFlags); if (field == null) { field = targetType.GetField(property.Name, FieldBindingFlags); } if (field != null) { descriptors.Add(new BackingFieldDescriptor(property.Name, field)); } } return(descriptors); }
public IEnumerable <PropertyDescriptor> Select(PropertyWriterArgs args) => _others .SelectMany(writer => writer.Select(args)) .GroupBy(prop => prop.Name) .Select(propertyGroup => new FallbackDescriptor(propertyGroup));