C# Coding Standard 一、命名 1.用pascal規則來命名方法和類型.public class TextBox{ public void DataBind() { }} 2.用camel規則來命名局部變數和方法的參數.string userName;public AddUser(string userId, byte[] password); 3.所有的成員變數前加首碼 m_public class Database{ public
Ted GraHam 提到了39 條 CheckList, 我覺得還是總結的挺全面.Are exceptions used to indicate error rather than returning status or error codes? 使用異常來只是錯誤而不是使用狀態或者錯誤碼值 Are all classes and public methods commented with .NET style comments?? Note that comments should
規範 作為有關 C# 語言規範漫談的繼續,本月我們將討論運算子多載的問題。運算子多載(除非特別指明,否則本專欄的其餘部分一律將其簡稱為“重載”)是指允許使用者使用使用者定義的類型編寫運算式的能力。它允許使用者定義的類型與預定義的類型具有相同的功能。例如,通常需要編寫類似於以下內容的代碼,以將兩個數字相加。很明顯,sum 是兩個數字之和。int i = 5;int sum = i + j;如果可以使用代表複數的使用者定義的類型來編寫相同類型的運算式,
Generics in C# Generics are the most useful C# 2.0 language extensions, beside Anonymous methods, Iterators, Partial types And Nullable types.What are generics?Generics permit classes, structs, interfaces, delegates, and methods to be parameterized
C# 繪圖--飄帶楊賀宏 //-------------------------------------// DrawStreamer.cs by Flycrane//------------------------------------- using System; using System.Drawing; using System.Windows.Forms; class DrawStreamer : Form { publicstaticvoidMain() {