随笔分类 - .NET基础
摘要:判断相等的3个方法实例方法 public virtual bool Equals(object obj) { return RuntimeHelpers.Equals(this, obj); }比较值类型静态方法 public static bool Equals(object objA, object objB) { return ((objA == objB) || (((objA != null) && (objB != null)) && objA.Equals(objB))); }比较引用类型静态方法 public static bool Refere
阅读全文
摘要:基本□ 哪些属于引用类型类(object,string),接口、数组、委托□ 引用类型分配在哪里● 引用类型变量位于线程栈。 ● 引用类型实例分配在托管堆上。 ● 当引用类型实例的大小小于85000bytes,被分配在GC堆上,当大于或等于85000bytes,被分配在LOH(Large Object Heap)上。□ 变量(Variable),对象(Object),实例(Instance)变量: 变量分配在线程栈上。 变量可以是值类型,也可以是引用类型。 当变量是引用类型时,包含了对对象的引用(内存地址),也叫做"对象引用"。对象: 对类、接口、委托和数组等的一个抽象描述
阅读全文
摘要:1、在记事本中编写代码。 using System; namespace HelloWorld { public class Program { static void Main(string[] args) { Console.WriteLine("Hello,World"); ...
阅读全文
摘要:1、在记事本中编写IL代码如下:.assembly HelloWorld{}.assembly extern mscorlib{}.method public static void Main(string[] args) { .entrypoint .maxstack 8 ldstr "Hello,World" call void [mscorlib]System.Console::WriteLine(string) call valuetype [mscorlib]System.ConsoleKeyInfo [mscorlib]System.Console::...
阅读全文
摘要:分配在栈上、派生于System.ValueType的值类型:● 简单类型,比如int,uint,byte,sbyte,short,long,ulong,char,float,double,decmial,bool都属于值类型。简单类型对应BCL基类库的别名,比如byte对应System.Byte,short对应System.Int16等。● 结构和枚举属于值类型。 什么是BCL基类库:Base ...
阅读全文
摘要:控制台代码 using System; namespace ConsoleApplication1 { class Program { static void Main(string[] args) { Console.WriteLine("Hello, World!"); ...
阅读全文
浙公网安备 33010602011771号