zoukankan      html  css  js  c++  java
  • C# dll加载,抽象方法的使用

    抽象类! 

    dll的使用

    /// <summary>
    /// 返回类型--插件
    /// </summary>
    /// <param name="baseName"></param>
    /// <param name="name"></param>
    /// <param name="attname"></param>
    /// <returns></returns>
    private Type GetPlugin(string baseName, string name, string attname)
    {
    Hashtable hashtable = this.GetPluginCache();
    name = name.ToLower();
    Type type = hashtable[name] as Type;
    Type result;
    if (type == null)
    {
    if (PluginContainer.pluginCache.Get(this.IndexCacheKey) == null)
    {
    result = null;
    return result;
    }
    XmlDocument xmlDocument = PluginContainer.pluginCache.Get(this.IndexCacheKey) as XmlDocument;
    XmlNode xmlNode = xmlDocument.DocumentElement.SelectSingleNode(string.Concat(new string[]
    {
    "//",
    baseName,
    "/item[@",
    attname,
    "='",
    name,
    "']"
    }));
    if (xmlNode == null || !File.Exists(xmlNode.Attributes["file"].Value))
    {
    result = null;
    return result;
    }
    Assembly assembly = Assembly.Load(PluginContainer.LoadPlugin(xmlNode.Attributes["file"].Value));
    type = assembly.GetType(xmlNode.Attributes["identity"].Value, false, true);
    if (type != null)
    {
    hashtable[name] = type;
    }
    }
    result = type;
    return result;
    }

  • 相关阅读:
    luogu P3295 [SCOI2016]萌萌哒
    luogu P4916 魔力环
    CF997C Sky Full of Stars
    CF961G Partitions
    android屏蔽软键盘并且显示光标
    设置和获取Android中各种音量
    自定义广播
    发送广播
    android取高度
    Java数字格式化
  • 原文地址:https://www.cnblogs.com/zxs-onestar/p/5993084.html
Copyright © 2011-2022 走看看