Click here to Skip to main content
12,348,760 members (38,348 online)
Click here to Skip to main content
Add your own
alternative version

Tagged as

Stats

4.6K views
5 bookmarked
Posted

Best practices in developing ASP.NET applications

, 3 Feb 2011 CPOL
Rate this:
Please Sign up or sign in to vote.
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, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

_impostor_
Web Developer
Australia Australia
No Biography provided

You may also be interested in...

Comments and Discussions

 
Questionif you are working an application, we always have somthing i... Pin
dad42448-Jan-13 4:12
memberdad42448-Jan-13 4:12 
Generalif you are working an application, we always have somthing i... Pin
Mahendra Vishwakarma4-Feb-11 5:11
memberMahendra Vishwakarma4-Feb-11 5:11 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.160621.1 | Last Updated 3 Feb 2011
Article Copyright 2011 by _impostor_
Everything else Copyright © CodeProject, 1999-2016
Layout: fixed | fluid