当前位置:网站首页>c#开发知识点总结
c#开发知识点总结
2022-07-29 20:40:00 【安替-AnTi】
Inno Setup常量介绍
获取文件夹下的所有文件的文件名
DirectoryInfo TheFolder=new DirectoryInfo(folderFullName);
//遍历文件夹
foreach(DirectoryInfo NextFolder in TheFolder.GetDirectories())
this.listBox1.Items.Add(NextFolder.Name);
//遍历文件
foreach(FileInfo NextFile in TheFolder.GetFiles())
this.listBox2.Items.Add(NextFile.Name);
读取AssemblyInfo文件中的属性值
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
namespace TestAutoUpdate
{
/// <summary>
/// 使用此类前需要把[assembly: ComVisible(false)]改为true
/// </summary>
class AssemblyInformation
{
#region 程序集属性访问器
/// <summary>
/// 标题
/// </summary>
public string AssemblyTitle
{
get
{
object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyTitleAttribute), false);
if (attributes.Length > 0)
{
AssemblyTitleAttribute titleAttribute = (AssemblyTitleAttribute)attributes[0];
if (titleAttribute.Title != "")
{
return titleAttribute.Title;
}
}
return System.IO.Path.GetFileNameWithoutExtension(Assembly.GetExecutingAssembly().CodeBase);
}
}
/// <summary>
/// 版本
/// </summary>
public string AssemblyVersion
{
get
{
return Assembly.GetExecutingAssembly().GetName().Version.ToString();
}
}
/// <summary>
/// 说明
/// </summary>
public string AssemblyDescription
{
get
{
object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyDescriptionAttribute), false);
if (attributes.Length == 0)
{
return "";
}
return ((AssemblyDescriptionAttribute)attributes[0]).Description;
}
}
/// <summary>
/// 产品
/// </summary>
public string AssemblyProduct
{
get
{
object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyProductAttribute), false);
if (attributes.Length == 0)
{
return "";
}
return ((AssemblyProductAttribute)attributes[0]).Product;
}
}
/// <summary>
/// 版权
/// </summary>
public string AssemblyCopyright
{
get
{
object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyCopyrightAttribute), false);
if (attributes.Length == 0)
{
return "";
}
return ((AssemblyCopyrightAttribute)attributes[0]).Copyright;
}
}
/// <summary>
/// 公司
/// </summary>
public string AssemblyCompany
{
get
{
object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyCompanyAttribute), false);
if (attributes.Length == 0)
{
return "";
}
return ((AssemblyCompanyAttribute)attributes[0]).Company;
}
}
/// <summary>
/// 配置
/// </summary>
public string AssemblyConfiguration
{
get
{
object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyConfigurationAttribute), false);
if (attributes.Length == 0)
{
return "";
}
return ((AssemblyConfigurationAttribute)attributes[0]).Configuration;
}
}
/// <summary>
/// 商标
/// </summary>
public string AssemblyTrademark
{
get
{
object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyTrademarkAttribute), false);
if (attributes.Length == 0)
{
return "";
}
return ((AssemblyTrademarkAttribute)attributes[0]).Trademark;
}
}
/// <summary>
/// 文化
/// </summary>
public string AssemblyCulture
{
get
{
object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyCultureAttribute), false);
if (attributes.Length == 0)
{
return "";
}
return ((AssemblyCultureAttribute)attributes[0]).Culture;
}
}
#endregion
}
}
参考文献
边栏推荐
- 4. Implementation Guide for GET_ENTITYSET Method of SAP ABAP OData Service Data Provider Class
- 无文件落地免杀的初尝试思考(上)
- 微信小程序 31 分包机制
- C# 窗体与子线程数据交互
- LeetCode 0593. 有效的正方形
- 干货!联邦学习中的合作均衡
- 最小jvm源码分析
- Sasser virus source code (ransomware source code)
- 分析少年派2中的Crypto
- The difference between uri and url is simple to understand (what is the difference between uri and url)
猜你喜欢
随机推荐
240. 搜索二维矩阵 II
【593. 有效的正方形】
用 Array.every & Array.some 匹配全部/部分内容 es6
容器网络硬核技术内幕 (26) 知微知彰,知柔知刚 (下)
第二好PyTorch新手课程;论文写作指南;使用µGo语言开发迷你编译器;超高效使用Transformer的扩展库;前沿论文 | ShowMeAI资讯日报
一 JS中Promise用法、二闭包的概念与用法、三对象创建的四种方式与区区别、四 如何声明一个类
手写dialog弹框
C# 窗体与子线程数据交互
如何进入董事会:给CIO的十条建议
容器网络硬核技术内幕 (小结-下)
The younger brother asked: Is the work of a programmer a day’s work of code?
全自动化机器学习建模!效果吊打初级炼丹师!
VSCode配置终端为系统命令行
【数据库】mysql日期格式转换
关于论青少年尽早学少儿编程之说
Chrome浏览器打印flash log
SAP ABAP OData 服务 Data Provider Class 的 GET_ENTITYSET 方法实现指南试读版
怎么实现您的个人知识库?
MySQL Data Query - Simple Query
博世集团启动量子数字孪生计划









