String.IsNullOrEmpty()

Link. December 19, 2005. Comments [3]. Posted in: .NET
Steve Eichert talks about how he likes the new String.IsNullOrEmpty() in .NET 2.0. I agree it is a welcomed addition to the base libraries, and I for one I'm trying to make it a habit of using it whenever I need to do those kinds of comparisons, as it makes the code far simpler and more readable.

Now, what I'd like to see is an extended version that also Trim()s the string and checks to see if that is empty :) (how common is this for validation, huh?)



Thursday, December 22, 2005 1:26:43 AM (SA Pacific Standard Time, UTC-05:00)

String.Trim.IsNullOrEmpty()

JP
Tuesday, April 04, 2006 2:43:03 PM (SA Pacific Standard Time, UTC-05:00)
> String.Trim.IsNullOrEmpty()

That's silly. It has be to something like String.TrimIsNullOrEmpty(x) or String.IsNullOrEmpty(x, TrimBoth)

That said, it would be useful. If you don't want blanks, a single space is just as bad.


Jonathan Allen
Wednesday, July 11, 2007 9:04:35 AM (SA Pacific Standard Time, UTC-05:00)
Ídolo, totalmente de acuerdo. Mine is called IsNullOrBlank.

Thank you amigo.
Lupita Gonzalez
Comments are closed.

Syndicate

About

Tomas Restrepo is a software developer located in Colombia, South America. His interests include .NET, Connected Systems, PowerShell and lately dynamic programming languages. More...

tomasrestrepo @ twitter My Flickr photostream My saved links on delicious My Technorati Profile

email: tomas@winterdom.com
msn: tomasr@passport.com

View my profile on LinkedIn

MVP logo

Ads


Categories

Statistics

Total Posts: 1050
This Year: 1
This Month: 1
This Week: 0
Comments: 825

Archive

Other

Copyright © 2002-2008, Tomas Restrepo.

Powered by: newtelligence dasBlog 2.2.8279.16125

Sign In