Fear of scratch (this can also lead to serious problems):
if (name != null) person.Name = name;
If reservation (not using another):
if (!IsPostback) { // do something } if (IsPostback) { // do something else }
Fallback checks (Split never returns null):
string[] words = sentence.Split(' '); if (words != null)
More about checks (the second check is redundant if you are going to do a loop)
if (myArray != null && myArray.Length > 0) foreach (string s in myArray)
And my favorite for ASP.NET: Scattered DataBind throughout the code to render the page.
Panos
source share