zoukankan      html  css  js  c++  java
  • MEF example code

    public interface IObjectResolver
        {
        }
    public class ObjectResolver:IObjectResolver
        {
          private CompositionContainer container;
    
          public ObjectResolver()
          {
              container = new CompositionContainer(new AggregateCatalog());
          }
          public void AddCatalogFile(string fileName)
          {
              if (!File.Exists(fileName))
                  throw new FileNotFoundException();
              AggregateCatalog catalog = (AggregateCatalog)container.Catalog;
              catalog.Catalogs.Add(new AssemblyCatalog(fileName));
              container.ComposeParts();
          }
          public T GetExport<T>(string name)
          {
              return container.GetExportedValue<T>(name);
          }
        }
  • 相关阅读:
    四种wordpress常用的循环结构
    自动创建网页文章目录结构
    shell
    SSH
    架构
    Https
    if-else、switch、while、for
    do-while
    const
    Tail Call
  • 原文地址:https://www.cnblogs.com/phenixyu/p/4464919.html
Copyright © 2011-2022 走看看