コード例 #1
0
 public IEnumerable <PropertyDescriptor> Select(PropertyWriterArgs args)
 {
     return(args
            .TargetType
            .GetProperties(BindingFlags.Public | BindingFlags.Instance)
            .Where(prop => prop.CanWrite)
            .Select(prop => new PrivateSetterDescriptor(prop)));
 }
コード例 #2
0
        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);
        }
コード例 #3
0
 public IEnumerable <PropertyDescriptor> Select(PropertyWriterArgs args) => _others
 .SelectMany(writer => writer.Select(args))
 .GroupBy(prop => prop.Name)
 .Select(propertyGroup => new FallbackDescriptor(propertyGroup));