当前位置:网站首页>C Advanced Programming - features
C Advanced Programming - features
2022-06-13 07:04:00 【Light of ten thousand years】
characteristic
1. Definition of custom attribute class
When defining a custom attribute class, the class name suffix must be Attribute, You also need to inherit from Attribute class , And its application scope must be specified , As shown in the following code :
[AttributeUsage(AttributeTargets.Class)]// Act on a class
class sealed UIAttribute:Attribute
{
public int number;
}
2. How to get features
Get by reflection ( Reflection is generally class 、 File reading ), As shown below :
[UI(number=100)]
class Fk{
}
void Main()// Here's the imitation c++ Of main Function writing , No need to notice
{
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);
}
}
边栏推荐
- Will the chain 2+1 model be a new business outlet and a popular Internet e-commerce market?
- 2022-06-12:在N*N的正方形棋盘中,有N*N个棋子,那么每个格子正好可以拥有一个棋子。 但是现在有些棋子聚集到一个格子上了,比如: 2 0 3 0 1 0 3 0 0 如上的二维数组代表,一
- Introduction and use of dumping
- 2022 - 06 - 12: dans un échiquier carré n * N, il y a n * n pièces, donc chaque pièce peut avoir exactement une pièce. Mais maintenant quelques pièces sont rassemblées sur une grille, par exemple: 2 0
- 在产业互联网的概念刚刚出现时,人们仅仅只是将其看成是一个获取B端流量的方法
- Upper computer development (detailed design of firmware download software)
- Tikv key performance parameters and optimization
- [Collection des questions d'examen les plus complètes de Tencent Ali] (quatre côtés: 3 tours de technologie + 1 tour de RH)
- NFV基本概述
- 1154. day of the year
猜你喜欢

Periodontitis investigation (ongoing)

如何使用望友DFM軟件進行冷板分析

In the era of membership based social e-commerce, how do businesses build their own private domain traffic pool?

Tikv key performance parameters and optimization

Intelligent entertainment has developed steadily, and jinglianwen technology provides data collection and labeling services

Test development programmers, are you still confused? You can't define yourself as a yard farmer

Tidb index optimization

测试开发程序员,你还在迷茫吗?不能把自己定义为码农......

FSM state machine

Lightning breakpoint continuation
随机推荐
Detailed Mr Atlas of hip joint (Reprinted)
JS method of extracting numbers from strings
杭州网上开户是安全的吗?
Evolution in the digital age
RT-Thread 模拟器 simulator LVGL控件:slider 控件
What is the essence of social e-commerce disruption? How can businesses get more traffic?
不间断管理设计
上位机开发(固件下载软件之软件测试)
牙周炎问题调研(持续进行中)
What does my financial product mean in clearing?
2022-06-12:在N*N的正方形棋盤中,有N*N個棋子,那麼每個格子正好可以擁有一個棋子。 但是現在有些棋子聚集到一個格子上了,比如: 2 0 3 0 1 0 3 0 0 如上的二維數組代錶,一
Why is the new e-commerce outlet mode so popular? What is the specific mode?
Eureka server multi node deployment
What is online blind box e-commerce? Can blind box e-commerce become a new bonus market for the Internet?
Tidb statistics
Tidb implementation plan -- I
树莓派高级开发——“IO口驱动代码的编写“ 包含总线地址、物理_虚拟地址、BCM2835芯片手册知识
RT thread simulator lvgl control: button button style
【騰訊阿裏最全面試題集錦】(四面:3輪技術+1輪HR)
Recently, the popular social e-commerce marketing model, blind box e-commerce, how beautiful every second is accurately drained