Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/--> using System.Net; /// <summary> /// 得到用戶電腦資訊 /// </summary> public void GetUserInfo() {
局部類型(partial)我個人理解為,就是將一個整體拆分成一個個部分。我們用一段代碼來理解Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/--> /// <summary> /// 定義MyClass類的一個部分 /// </summary> public partial class MyClass
1: using System; 2: using System.Collections.Generic; 3: using System.ComponentModel; 4: using System.Data; 5: using System.Diagnostics; 6: using System.Drawing; 7: using System.Linq; 8: using System.Runtime.InteropServices; 9
.NET的所有類型都是由基類System.Object繼承過來的,包括最常用的基礎類型:int, byte, short,bool等等,就是說所有的事物都是對象。但這樣造成了極低的效率,比如簡單的兩個數相加,bool取反都會導致從堆(Heap)中分配記憶體。怎樣解決這個問題呢?.NET把類型分成了兩類:值型和引用型。值型在棧中分配記憶體,它們在聲明的同時就初始化,以確保資料不為NULL。例如:byte b =
今天做一個項目中用到把DataSet對象序列化成檔案,並上傳到伺服器,不過產生的檔案比較大,就想著壓縮一下,找了一下資料,用GZipStream來壓縮了一下,效果還是非常理想的。現在把這部分代碼整理了一下: Code highlighting produced by Actipro CodeHighlighter
Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->using System; using System.Collections.Generic; class DictionaryDemo { static void Main(string[] args) { DictionaryDemo001
從COM組件調用.NET組件編程實戰 先從紅馬天下的三編博文開始吧,用C#編寫ActiveX控制項(一)、用C#編寫ActiveX控制項(二)、用C#編寫ActiveX控制項(三) 。但是不知道為什麼我用Vs2008的按著做完後,還是不能用,不知道為什麼。以下是一些ActiveX開發的文章:C#開發ActiveX控制項 Web中使用ActiveX控制項(C#篇) Exposing Windows Forms Controls as ActiveX
c# 的存取修飾詞是private 還是 internal? 準確的說,不能一概而論。 [MSDN] Classes and structs that are not nested within other classes or structs can be either public or internal. A type declared as public is accessible by any other type. A type declared as internal is
特性(attribute)是被指定給某一聲明的一則附加的聲明性資訊。在C#中,有一個小的預定義特性集合。在學習如何建立我們自己的定製特性(custom attributes)之前,我們先來看看在我們的代碼中如何使用預定義特性。 using System; public class AnyClass { [Obsolete("Don't use Old method, use New method", true)] static void Old( ) { }