当前位置:网站首页>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
}
}
参考文献
边栏推荐
- MySQL - Design game user information table
- 人社部公布“数据库运行管理员”成新职业,OceanBase参与制定职业标准
- 【无标题】
- 手写dialog弹框
- R language for airbnb data nlp text mining, geography, word cloud visualization, regression GAM model, cross-validation analysis
- OneNote tutorial, how to take notes in OneNote?
- 第二好PyTorch新手课程;论文写作指南;使用µGo语言开发迷你编译器;超高效使用Transformer的扩展库;前沿论文 | ShowMeAI资讯日报
- 点击返回顶部
- 容器网络硬核技术内幕 (22) 安全与自由兼顾
- 磁性层状双金属氢氧化物和酶-DNA复合物|聚乙烯亚胺-DNA复合物(PEI/DNA)|作用机理
猜你喜欢

PyQt5学习一(环境搭建)

五个供应商销售谈判策略的识别以及应对它们的方法

Setinel 原理简介

UDP协议详解

First thoughts on the first attempt to avoid killing without a file (Part 1)

探索创客教育在线管理实施体系

怎么实现您的个人知识库?

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

JSP Servlet JDBC MySQL CRUD Sample Tutorial

Second Best PyTorch Beginner Course; Thesis Writing Guide; Using µGo to Develop a Mini Compiler; Super Efficient Use of Transformer's Extension Library; Frontier Papers | ShowMeAI News Daily
随机推荐
RedisJson 横空出世!
JSP Servlet JDBC MySQL CRUD Sample Tutorial
Unity determines whether a string can be converted to float type
网站ping端口的操作方法和命令介绍
【无标题】
940. Different subsequences II
点击返回顶部
:class数组写法
What are the software development modes (software engineering development mode)
R language for airbnb data nlp text mining, geography, word cloud visualization, regression GAM model, cross-validation analysis
促进二十一世纪创客教育的新发展
南华早报 | 助力亚洲最具公信力报章实现AD域自动化管理
.NET 6.0中使用Identity框架实现JWT身份认证与授权
全自动化机器学习建模!效果吊打初级炼丹师!
五个供应商销售谈判策略的识别以及应对它们的方法
赶紧进来!!!带你认识C语言基本数据类型
conda virtual environment | install and list problems
leetcode-593:有效的正方形
Writing Elegant Kotlin Code: Talk About What I Think "Kotlinic"
LeetCode 0593. 有效的正方形