public static T SingleOrDefault <T>(this IDirectiveCollection directives) =>
 directives
 .Where(t => typeof(T).IsAssignableFrom(t.Type.RuntimeType))
 .Select(t => t.ToObject <T>()).SingleOrDefault();
Exemple #2
0
 private static IReadOnlyCollection <IDirective> GetValidationDirectives(IDirectiveCollection collection)
 {
     return(collection.Where(d => d.Type is IValidationDirectiveType).ToList());
 }