Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles
(untagged)

Best practices in developing ASP.NET applications

0.00/5 (No votes)
3 Feb 2011 1  
Initializing is great... unless you have no control over the contents.Consider this:String strTmp = String.Empty;strTmp = SomeRandomMethod();//Suppose SomeRandomMethod returns null under some circumstances...Now anything you try to do with strTmp (other than compare to null) will...
Initializing is great... unless you have no control over the contents.

Consider this:

String strTmp = String.Empty;
strTmp = SomeRandomMethod();
//Suppose SomeRandomMethod returns null under some circumstances...

Now anything you try to do with strTmp (other than compare to null) will cause an exception - inlcuding the original tip:
if (strTmp.Length == 0) {
//etc
}

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here