C# 入门

 

Attributes

The following list includes a few of the common uses of attributes in code:

  • Marking methods using the WebMethod attribute in Web services to indicate that the method should be callable over the SOAP protocol. For more information, see WebMethodAttribute.
  • Describing how to marshal method parameters when interoperating with native code. For more information, see MarshalAsAttribute.
  • Describing the COM properties for classes, methods, and interfaces.
  • Calling unmanaged code using the DllImportAttribute class.
  • Describing your assembly in terms of title, version, description, or trademark.
  • Describing which members of a class to serialize for persistence.
  • Describing how to map between class members and XML nodes for XML serialization.
  • Describing the security requirements for methods.
  • Specifying characteristics used to enforce security.
  • Controlling optimizations by the just-in-time (JIT) compiler so the code remains easy to debug.
  • Obtaining information about the caller to a method.

system.reflection

 Reflection provides objects (of type Type) that describe assemblies, modules, and types. You can use reflection to dynamically create an instance of a type, bind the type to an existing object, or get the type from an existing object and invoke its methods or access its fields and properties. If you are using attributes in your code, reflection enables you to access them. 

 

Reflection is useful in the following situations:

 

assemblies

 

 

 Managed Extensibility Framework

 

Serialization 

 

Common Language Runtime (CLR)

 

.Net Core源代码

 

Refference:

1. 官方文档

2. RunooB的中文版教程

3. 虚拟机随谈(一):解释器,树遍历解释器,基于栈与基于寄存器,大杂烩

4..net 框架浅析

5. C# 从入门到精通

posted on 2020-09-25 22:15  KHacker  阅读(126)  评论(0编辑  收藏  举报