コード例 #1
0
 /// <summary>
 /// Looks for first plugin of this type in Plugins.
 /// Reflection performance penalty.
 /// </summary>
 public T GetPlugin <T>() where T : class, IPlugin
 {
     return(Plugins.FirstOrDefault(x => x is T) as T);
 }
コード例 #2
0
 public bool HasPlugin <T>() where T : class, IPlugin
 {
     return(Plugins.FirstOrDefault(x => x is T) != null);
 }
コード例 #3
0
 /// <summary>
 /// Looks for first plugin of this type in Plugins.
 /// Reflection performance penalty.
 /// </summary>
 public TPlugin GetPlugin <TPlugin>() where TPlugin : class, IPlugin
 {
     return(Plugins.FirstOrDefault(x => x is TPlugin) as TPlugin);
 }