当前位置:网站首页>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
}
}
参考文献
边栏推荐
- 7 行代码搞崩溃 B 站,原因令人唏嘘!
- 诺氟沙星-DNA复合物|半乳糖化脂质体-聚阳离子-DNA复合物|注意事项
- OneNote 教程,如何在 OneNote 中做笔记?
- 如何优雅的自定义 ThreadPoolExecutor 线程池
- 微信小程序 30 自定义模板和获取用户登录凭证
- 酷客导航助你商场轻松购物,业务办理不迷茫
- Related phrases include usage and collocation (include)
- 磁性层状双金属氢氧化物和酶-DNA复合物|聚乙烯亚胺-DNA复合物(PEI/DNA)|作用机理
- Huawei laptop keyboard locked (how does the laptop keyboard light up)
- Use the PostgreSQL GRANT command to modify permissions on various database objects
猜你喜欢

1. Promise usage in JS, 2. The concept and usage of closures, 3. The difference between the four methods and areas of object creation, 4. How to declare a class

人社部公布“数据库运行管理员”成新职业,OceanBase参与制定职业标准

【无标题】

OAuth,JWT ,OIDC你们搞得我好乱啊

Liu Genghong, boys and girls, come here!Sports data analysis and mining!(with a full set of code and data sets)

Qualcomm WLAN framework learning (31) -- Power save

The Ministry of Human Resources and Social Security announced that "database operation administrator" has become a new occupation, and OceanBase participated in the formulation of occupational standar

一 JS中Promise用法、二闭包的概念与用法、三对象创建的四种方式与区区别、四 如何声明一个类

C#笔记 之 Oracle.ManagedDataAccess包的安装及配置

VR直播营销需求增加,数据模块为我们铺路
随机推荐
回归——岭回归
系列(jupyter自动保存失败)
怎么实现您的个人知识库?
南华早报 | 助力亚洲最具公信力报章实现AD域自动化管理
[ACTF2020 Freshman Competition]Exec 1
:class数组写法
人社部公布“数据库运行管理员”成新职业,OceanBase参与制定职业标准
7 行代码搞崩溃 B 站,原因令人唏嘘!
无文件落地免杀的初尝试思考(上)
什么是数据安全性?
Cooler Navigation helps you shop easily in shopping malls without confusion
The difference between analog, digital and switching
模型推理模板
探索创客教育在线管理实施体系
WeChat Mini Program 31 Subcontracting Mechanism
微博账号奇葩逻辑产品设计
分布式之基石: 可靠性——What a tangled web we weave
C# WPF给综合实战项目加个帮助文档
全自动化机器学习建模!效果吊打初级炼丹师!
LeetCode--单链表--146.LRU缓存