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.
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:
- When you have to access attributes in your program's metadata. For more information, see Retrieving Information Stored in Attributes.
- For examining and instantiating types in an assembly.
- For building new types at runtime. Use classes in System.Reflection.Emit.
- For performing late binding, accessing methods on types created at run time. See the topic Dynamically Loading and Using Types.
assemblies
Managed Extensibility Framework
Serialization
Common Language Runtime (CLR)
.Net Core源代码
Refference:
1. 官方文档
2. RunooB的中文版教程
3. 虚拟机随谈(一):解释器,树遍历解释器,基于栈与基于寄存器,大杂烩
5. C# 从入门到精通