当前位置:网站首页>C # Advanced Programming - Feature Section
C # Advanced Programming - Feature Section
2022-06-13 07:04:00 【Lumière de dix mille ans】
Caractéristiques
1.Personnaliser la définition de la classe de propriétés
Le suffixe nom de classe doit êtreAttribute,Doit également hériterAttributeCatégorie,Et vous devez spécifier son champ d'application,Le code ci - dessous:
[AttributeUsage(AttributeTargets.Class)]//Action sur la classe
class sealed UIAttribute:Attribute
{
public int number;
}
2.Comment obtenir les caractéristiques
Par réflexe pour obtenir(Les réflexions sont généralement de type、Lecture du fichier),Comme suit:
[UI(number=100)]
class Fk{
}
void Main()//Imitation icic++Demainécriture de la fonction,Aucune attention requise
{
UIAttribute[] s = (UIAttribute[])t.GetCustomAttributes(typeof(UIAttribute), false);
//FKAttribute[] s = t.GetCustomAttributes(typeof(FKAttribute), false) as FKAttribute[];
foreach(var s1 in s) {
Console.WriteLine("fk"+s1.number);
}
}
边栏推荐
- Reflection of C # Foundation
- Why does TCP establish three handshakes and four waves
- 杭州证券开户是安全的吗?
- 如何使用望友DFM軟件進行冷板分析
- 2022-06-12:在N*N的正方形棋盤中,有N*N個棋子,那麼每個格子正好可以擁有一個棋子。 但是現在有些棋子聚集到一個格子上了,比如: 2 0 3 0 1 0 3 0 0 如上的二維數組代錶,一
- 测试开发程序员,你还在迷茫吗?不能把自己定义为码农......
- 检测循环数“142857“
- Will the chain 2+1 model be a new business outlet and a popular Internet e-commerce market?
- Brief introduction to basic usage of echart
- What does my financial product mean in clearing?
猜你喜欢

Do you want to carry out rapid steel mesh design and ensure the quality of steel mesh? Look here

AIO Introduction (VIII)

2022-06-12:在N*N的正方形棋盘中,有N*N个棋子,那么每个格子正好可以拥有一个棋子。 但是现在有些棋子聚集到一个格子上了,比如: 2 0 3 0 1 0 3 0 0 如上的二维数组代表,一

基于FPGA的ds18b20温度传感器使用

ML之FE:Vintage曲线/Vintage分析的简介、计算逻辑、案例应用之详细攻略

How to quickly support the team leader to attract new fission users in the business marketing mode of group rebate?

Why is the blind box e-commerce mode so popular?

基于SSM实现水果商城批发平台

Why is the new e-commerce outlet mode so popular? What is the specific mode?

What is online blind box e-commerce? Can blind box e-commerce become a new bonus market for the Internet?
随机推荐
AIO Introduction (VIII)
【云原生 | Kubernetes篇】Kubernetes 配置
Monotone stack top31 of interview must brush algorithm top101
FSM state machine
Lightning data import
在 localStorage 中上传和检索存储图像
Ml: introduction to stability analysis of machine learning model and detailed introduction to common solutions
The new retail market has set off blind box e-commerce. Can the new blind box marketing model bring dividends to businesses?
RT-Thread 模拟器 simulator LVGL控件:button 按钮样式
Recently, the popular social e-commerce marketing model, blind box e-commerce, how beautiful every second is accurately drained
How to write an amazing design document?
SDN basic overview
牙周炎问题调研(持续进行中)
YOLOv5解析 | 参数与性能指标
How to seize the bonus of social e-commerce through brand play to achieve growth and profit?
面试必刷算法TOP101之单调栈 TOP31
Eureka server multi node deployment
JS case Xiaomi second kill countdown New Year Countdown
Upper computer development (detailed design of firmware download software)
ML:机器学习模型的稳定性分析简介、常见的解决方法之详细攻略