public Parameter(PropertyInfo propertyInfo, IHasPositionerCounter context) { Examples = new List <ExampleAttribute>(); var attributes = propertyInfo.GetAttributes <DescriptionAttribute>(); if (attributes.Count == 1) { Description = attributes[0].Text; } var argumentAttribute = propertyInfo.GetAttributes <ArgumentAttribute>().Single(); if (argumentAttribute is NamedArgumentAttribute) { var namedArgumentAttribute = (NamedArgumentAttribute)argumentAttribute; Shorthand = namedArgumentAttribute.ShortHand; Name = namedArgumentAttribute.Name; } else if (argumentAttribute is PositionalArgumentAttribute) { Position = context.Position++; } PropertyInfo = propertyInfo; ArgumentAttribute = argumentAttribute; foreach (var example in propertyInfo.GetAttributes <ExampleAttribute>()) { Examples.Add(example); } }
public Parameter(PropertyInfo propertyInfo, IHasPositionerCounter context) { Examples = new List<ExampleAttribute>(); var attributes = propertyInfo.GetAttributes<DescriptionAttribute>(); if (attributes.Count == 1) { Description = attributes[0].Text; } var argumentAttribute = propertyInfo.GetAttributes<ArgumentAttribute>().Single(); if (argumentAttribute is NamedArgumentAttribute) { var namedArgumentAttribute = (NamedArgumentAttribute)argumentAttribute; Shorthand = namedArgumentAttribute.ShortHand; Name = namedArgumentAttribute.Name; } else if (argumentAttribute is PositionalArgumentAttribute) { Position = context.Position++; } PropertyInfo = propertyInfo; ArgumentAttribute = argumentAttribute; foreach (var example in propertyInfo.GetAttributes<ExampleAttribute>()) { Examples.Add(example); } }