Пример #1
0
 /// <inheritdoc/>
 public abstract bool IsSupportingTemplate(TemplateDescription templateDescription);
Пример #2
0
 /// <summary>
 /// Finds a template generator supporting the specified template description
 /// </summary>
 /// <param name="description">The description.</param>
 /// <returns>A template generator supporting the specified description or null if not found.</returns>
 public static ITemplateGenerator <TParameters> FindTemplateGenerator <TParameters>(TemplateDescription description) where TParameters : TemplateGeneratorParameters
 {
     if (description == null)
     {
         throw new ArgumentNullException(nameof(description));
     }
     lock (ThisLock)
     {
         // From most recently registered to older
         for (int i = Generators.Count - 1; i >= 0; i--)
         {
             var generator = Generators[i] as ITemplateGenerator <TParameters>;
             if (generator != null && generator.IsSupportingTemplate(description))
             {
                 return(generator);
             }
         }
     }
     return(null);
 }