Identify the problem => Define the single purpose => Specify the inputs and outputs => State any assumptions => Consider the error that could occur
Signature
public bool PlaceOrder(Product product, int quantity)
Optional accessibility modifier (Default is private)
Return type (void if no value)
Method name
Parameter list (Empty parenthesis if no parameters)
XML Document Comment
Use ///
Summary for method purpose
param for a description of each parameter
Signature Best Practices
Do:
Use a verb
Define the most restricted accessibility possible
Keep the number of parameters to a minimum
Define an XML document comment
Avoid:
Vague terms
Abbreviations
Conjunctions (and/or)
Inconsistent naming
C# Best Practices - Creating Good Methods
原文:http://www.cnblogs.com/lmfy/p/5129672.html