摘要: usingSystem;usingSystem.Data;usingSystem.Configuration;usingSystem.Web;usingSystem.Web.Security;usingSystem.Web.UI;usingSystem.Web.UI.WebControls;usingSystem.Web.UI.WebControls.WebParts;usingSystem.Web.UI.HtmlControls;usingSystem.Runtime.InteropServices; namespacecom.Longle.CommonLibrary.Web{public. 阅读全文
posted @ 2013-02-18 16:38 Bruce-He 阅读(287) 评论(0) 推荐(0) 编辑
摘要: usingSystem;usingSystem.Collections.Generic;usingSystem.Linq;usingSystem.Windows.Forms; namespaceWinformLogDemo{staticclassProgram{///<summary>///应用程序的主入口点。///</summary>[STAThread]staticvoidMain(){try{Application.EnableVisualStyles();Application.SetCompatibleTextRenderingDefault(false);A 阅读全文
posted @ 2013-02-18 15:54 Bruce-He 阅读(403) 评论(0) 推荐(0) 编辑
摘要: using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace TEST{ class Program { static void Main(string[] args) { //Obj obj = new Obj(); //Obj obj2 = obj; //obj.Value = "1"; //obj.ID = 1; //Console.WriteLine("obj.value:"+obj.Value +" ID:&quo 阅读全文
posted @ 2013-02-18 14:35 Bruce-He 阅读(349) 评论(0) 推荐(0) 编辑
摘要: using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Collections;namespace FluentInterfaceDemo{ class Program { static void Main(string[] args) { Fluent fluent = new Fluent(); fluent.Money = 10000; Console.WriteLine(fluent.IsPass(f => f.Money)); Console.W 阅读全文
posted @ 2013-02-18 14:33 Bruce-He 阅读(309) 评论(0) 推荐(0) 编辑
摘要: 摘要:今天我们漫谈C#中的垃圾回收机制,本文将从垃圾回收机制的原理讲起,希望对大家有所帮助。 GC的前世与今生 虽然本文是以.NET作为目标来讲述GC,但是GC的概念并非才诞生不久。早 在1958年,由鼎鼎大名的图林奖得主John McCarthy所实现的Lisp语言就已经提供了GC的功能,这是GC的第一次出现。Lisp的程序员认为内存管理太重要了,所以不能由程序员自己来管 理。 但后来的日子里Lisp却没有成气候,采用内存手动管理的语言占据了上风,以 C为代表。出于同样的理由,不同的人却又不同的看法,C程序员认为内存管理太重要了,所以不能由系统来管理,并且讥笑Lisp程序慢如乌龟的运行... 阅读全文
posted @ 2013-02-18 13:08 Bruce-He 阅读(590) 评论(0) 推荐(0) 编辑
摘要: 理解堆与栈对于理 解.NET中的内存管理、垃圾回收、错误和异常、调试与日志有很大的帮助。垃圾回收的机制使程序员从复杂的内存管理中解脱出来,虽然绝大多数的C#程序并 不需要程序员手动管理内存,但这并不代表程序员就无需了解分配的对象是如何被回收的,在一些特殊的场合仍需要程序员手动进行内存管理。在32位的处理器上,每个进程的虚拟内存为4GB,.NET会在这4GB的内存块中开辟出3块内存,分别作为栈、托管堆、和非托管堆堆(heap):堆是从下往上分配,所以已用的空间在自由空间下面,C#中所有引用类型的对象分配在托管堆上,托管堆在内存上是连续分配的,并且内存对象的释放受垃圾收集机制的管理,效率相对于栈来 阅读全文
posted @ 2013-02-18 13:03 Bruce-He 阅读(271) 评论(0) 推荐(0) 编辑