public AnnotationDescription(AnnotationParser parser, Type type, Func <Annotation> initializer) { Parameters = type.GetProperties() .Select(c => (prop: c, param: c.GetCustomAttribute <ParameterAttribute>())) .Where(c => c.param != null) // Get all properties with parameters .OrderBy(c => c.param.LineNumber) // Sort by line number so params are correctly ordered .Select(c => new ParameterDescription(parser, c.prop)) // Create description of parameter .ToArray(); Initializer = initializer; }
public ParameterDescription(AnnotationParser parser, PropertyInfo property) { Property = property; ParameterReader = parser.GetReaderForType(property.PropertyType); }