Geeks With Blogs

News My Blog has been MOVED to https://mfreidge.wordpress.com
Michael Freidgeim's OLD Blog My Blog has been MOVED to https://mfreidge.wordpress.com
Good
if (String.Compare(myString, ALL_TEXT, StringComparison.OrdinalIgnoreCase) == 0)
                               {
                                        return true;
                               }
OK(not obvious what true means)

if (String.Compare(myString, ALL_TEXT, true) == 0)
                               {
                                        return true;
                               }
BAD: (non null safe)

if (myString.ToLower()==ALL_TEXT.ToLower()
                               {
                                        return true;
                               } Posted on Sunday, April 15, 2012 12:34 PM .Net Framework , General Tips | Back to top


Comments on this post: Code style Tip: Case insensitive string comparison

No comments posted yet.
Your comment:
 (will show your gravatar)


Copyright © Michael Freidgeim | Powered by: GeeksWithBlogs.net