C#可访问性级别
摘要:【C#可访问性级别】有几下几点需要注意:1、不嵌套在其他类型中的顶级类型的可访问性只能是internal或public。这些类型的默认可访问性是internal。如enum、class、struct、interface。2、嵌套类型是其他类型的成员,它们可以具有下表所示的声明的可访问性:3、嵌套类型...
阅读全文
C# vs C++/CLI 析构
摘要:【C# vs C++/CLI 析构】 For example, the following is a declaration of a finalizer 概念:1、Finalize 2、Dispose Difference: 1、C#中析构函数会被编译器替换为Finalize,代码永远不可以直接调
阅读全文
C#中的using
摘要:【using语句】 1)tusing语句,定义一个范围,在范围结束时处理对象。场景:当在某个代码段中使用了类的实例,而希望无论因为什么原因,只要离开了这个代码段就自动调用这个类实例的Dispose。要达到这样的目的,用try...catch来捕捉异常也是可以的,但用using也很方便。例如: 2)可
阅读全文
MSIL详解
摘要:When compiling to managed code, the compiler translates your source code into Microsoft intermediate language (MSIL), which is a CPU-independent set of instructions that can be efficiently converted to native code. MSIL includes instructions for loading, storing, initializing, and calling methods on
阅读全文
托管执行过程
摘要:Managed Execution ProcessThe managed execution process includes the following steps:Choosing a compiler.To obtain the benefits provided by the common language runtime, you must use one or more language compilers that target the runtime.Compiling your code to Microsoft intermediate language (MSIL).Co
阅读全文