当前位置:网站首页>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);
}
}
边栏推荐
- Smart finance is upgraded again, and jinglianwen technology provides data collection and labeling services
- 在 localStorage 中上传和检索存储图像
- 上位机开发(固件下载软件之详细设计)
- Vsys of Isis (virtual system)
- 2022-06-12:在N*N的正方形棋盘中,有N*N个棋子,那么每个格子正好可以拥有一个棋子。 但是现在有些棋子聚集到一个格子上了,比如: 2 0 3 0 1 0 3 0 0 如上的二维数组代表,一
- What is online blind box e-commerce? Can blind box e-commerce become a new bonus market for the Internet?
- Through the function seaborn cubehelix_ Palette build order palette
- 不间断管理设计
- As the new trend of blind box e-commerce, how can the platform use blind box play to drain at low cost?
- What does my financial product mean in clearing?
猜你喜欢

Tidb statistics

Ticdc introduction
![[weak transient signal detection] matlab simulation of SVM detection method for weak transient signal under chaotic background](/img/11/d6cd333a2fa56af2dc61b7597f1ada.png)
[weak transient signal detection] matlab simulation of SVM detection method for weak transient signal under chaotic background

RT-Thread 模拟器 simulator LVGL控件:slider 控件

What is the essence of social e-commerce disruption? How can businesses get more traffic?

树莓派高级开发——“IO口驱动代码的编写“ 包含总线地址、物理_虚拟地址、BCM2835芯片手册知识

【微弱瞬态信号检测】混沌背景下微弱瞬态信号的SVM检测方法的matlab仿真

Tree list under winfrom treelist related

MongoDB系列之SQL和NoSQL的区别

Jinglianwen Technology: current situation and solutions of data annotation industry
随机推荐
What is the new business model of Taishan crowdfunding in 2022?
Eureka server multi node deployment
号称下一代监控系统 来看看它有多牛逼
15、 IO stream (I)
【马尔科夫链-蒙特卡罗】马尔科夫链-蒙特卡罗方法对先验分布进行抽样
FSM状态机
How worker threads in the thread pool are recycled
【騰訊阿裏最全面試題集錦】(四面:3輪技術+1輪HR)
关于c#委托、事件相关问题
树莓派高级开发——“IO口驱动代码的编写“ 包含总线地址、物理_虚拟地址、BCM2835芯片手册知识
Tree list under winfrom treelist related
Why is the blind box e-commerce mode so popular?
杭州网上开户是安全的吗?
Application of DS18B20 temperature sensor based on FPGA
ISIS的vsys(虚拟系统)
Intelligent entertainment has developed steadily, and jinglianwen technology provides data collection and labeling services
上位机开发(固件下载软件之编码调试)
玄武云科技通过上市聆讯:业绩波动明显,陈永辉等三人为控股股东
Try to use renderdoc to view the shader code of UE
RT thread simulator lvgl control: button button style