C#之Windows Form Application与attribute

1. WPF是什么: Windows Presentation Foundation, 它提供了统一的编程模型、语言和框架,真正做到了分离界面设计人员与开发人员的工作, WPF由XAML( eXtensible Application Markup Language )语言编写。

2. Windows Form Project是由几个文件构成的:它们有不同的功能划分

3. 对于一个应用,最重要的就是对用户的各种events做出反应,那么监听器的实现就非常重要,而VS将监听器的设计界面化,我们只需要双击控件,VS就会自动生成默认的eventhandler的方法名,完成委托。

Attribute:

1. C# 提供一种对称为属性的声明标记进行定义的机制。可以将属性置于源代码的某些实体上以指定附加信息。可以在运行时通过反射检索属性包含的信息。您可以使用预定义属性或者定义自己的自定义属性。

2. Attributes and reflection have an intimate relationship with assembly metadata. Attributes are a part of that metadata, and reflection understands metadata, allowing you to extract information about attributes and code. 

3. attribute也有很多用途,分为很多类,但是它们都是开发者设定的警告或者需要注意的地方,如在使用标记了Obsolete特性的方法时会发出警告信息,而assembly可以设定一些环境变量之类的,attribute还能指定序列化

4. 我们也可以自己定义attribute,attribute对输出没有影响

5. Reflection provides the capability to discover information about a program at runtime. 

   1.Viewing metadata(可用于bug的信息检索)
   2.Performing type discovery
   3.Late binding to methods and properties
   4.Creating types at runtime (reflection emit)
原文地址:https://www.cnblogs.com/GameChina/p/4471030.html