using System; using System.Drawing; using System.Collections; using System.ComponentModel; using System.Windows.Forms; using com.prm.client.tools; using System.Data.OracleClient; //using com.prm.client.common; namespace com.prm.client.forms { ///
今天回答別人問題的時候,才發現原先的T.default文法被取消了,使用了新的default關鍵字來實現這一功能。還好回複前動手試了一下,不然就...-_-b下面詳細說明一下。之所以會用到default關鍵字,是因為需要在不知道型別參數為實值型別還是參考型別的情況下,為對象執行個體賦初值。考慮以下代碼:class TestDefault<T> { public T foo() { T t = null; //???
excel檔案中第一個表名的預設值是sheet1$, 但有時也會被改變為其他名字. 如果需要在C#中使用OleDb讀寫Excel檔案, 就需要知道這個名字是什麼. 以下代碼就是實現這個功能的: using System; using System.IO; using System.Data; using System.Data.OleDb; namespace Skyiv.Ben.Util { sealed class Pub { public static string GetExcelFir
1.Use Pascal casing for type and method names and constants:public class SomeClass{ const int DefaultSize = 100; public SomeMethod( ) {}} 2.Use camel casing for local variable names and method arguments:int number;void MyMethod(int someNumber)
1.Always build your projects with Warning Level 4 2.Treat warnings as errors in the Release build (note that this is not the default of Visual Studio). Although it is optional, this standard recommends treating warnings as errors in Debug builds as