public override IEnumerable <IPropertyDescriptor> GetProperties(Type type, object container)
        {
            return(innerTypeDescriptor.GetProperties(type, container)
                   .Where(p => p.GetCustomAttribute <YamlIgnoreAttribute>() == null)
                   .Select(p =>
            {
                var descriptor = new PropertyDescriptor(p);
                var member = p.GetCustomAttribute <YamlMemberAttribute>();
                if (member != null)
                {
                    if (member.SerializeAs != null)
                    {
                        descriptor.TypeOverride = member.SerializeAs;
                    }

                    descriptor.Order = member.Order;
                    descriptor.ScalarStyle = member.ScalarStyle;

                    if (member.Alias != null)
                    {
                        descriptor.Name = member.Alias;
                    }
                }

                return (IPropertyDescriptor)descriptor;
            })
                   .OrderBy(p => p.Order));
        }
 public override IEnumerable <IPropertyDescriptor> GetProperties(Type type, object container) =>
 from p in innerTypeDescriptor.GetProperties(type, container)
 select(IPropertyDescriptor) new PropertyDescriptor(p)
 {
     Name = namingConvention.Apply(p.Name)
 };
Esempio n. 3
0
 public override IEnumerable <IPropertyDescriptor> GetProperties(Type type, object container) =>
 from p in _innerTypeDescriptor.GetProperties(type, container)
     where p.CanWrite
 select p;