zoukankan      html  css  js  c++  java
  • Assembly C# 获取 内容 ProductAttribute version CopyrightAttribute FileVersionAttribute

    Assembly C# 获取 内容

                Assembly executingAssembly = Assembly.GetExecutingAssembly();
                Version version = executingAssembly.GetName().Version;

                object[] objectAttrs = executingAssembly.GetCustomAttributes(typeof(AssemblyProductAttribute), false );
                AssemblyProductAttribute productAttr = (AssemblyProductAttribute)objectAttrs[0];

                objectAttrs = executingAssembly.GetCustomAttributes(typeof(AssemblyCopyrightAttribute), false);
                AssemblyCopyrightAttribute copyrightAttr = (AssemblyCopyrightAttribute)objectAttrs[0];

                objectAttrs = executingAssembly.GetCustomAttributes(typeof(AssemblyFileVersionAttribute), false);
                AssemblyFileVersionAttribute fileAttr = (AssemblyFileVersionAttribute)objectAttrs[0];

                string v1 = version.ToString();
                string v2 = copyrightAttr.Copyright;
                string v3 = productAttr.Product;
                string v4 = fileAttr.Version;

  • 相关阅读:
    随机购买彩票问题
    for循环小题
    20150914 异常语句 math的方法 去空格 索引
    20150913生成三个10以内的随机数,不想等
    winform 计算器 两步走
    枚举、常量、结构
    视频嵌入网页, 分享嵌入网页!
    !!!框架集
    日常总结!!!
    随笔练习!!!
  • 原文地址:https://www.cnblogs.com/Rampage/p/2767540.html
Copyright © 2011-2022 走看看