Home All Groups Group Topic Archive Search About

[feature request] Array.IsNullOrEmpty

Author
10 Apr 2007 1:36 PM
Wiktor Zychla [C# MVP]
starting from .NET 2.0 there is a nice IsNullOrEmpty static method on a
System.String class which saves the time so instead of

string theString;

if ( theString != null && theString.Length > 0 )

you write

if ( !string.IsNullOrEmpty( theString ) )

I belive that the same pattern could be adopted for arrays so that instead
of

T[] array;

if ( array != null && array.Length > 0 )

you could write

if ( !Array.IsNullOrEmpty( array ) )

Regards,
Wiktor Zychla

Author
10 Apr 2007 5:50 PM
RobinS
I'm not sure what your point it. If you want to request an addition to the
language, try submitting it to Microsoft. Believe me, they're not sitting
around reading the public newsgroups hoping to find a valuable update idea.

https://connect.microsoft.com/availableconnections.aspx

Robin S.
-----------------------------------------------
Show quote
"Wiktor Zychla [C# MVP]" <wzyc***@nospm.ii.uni.wroc.pl.nospm> wrote in
message news:%23hpdwU3eHHA.3648@TK2MSFTNGP05.phx.gbl...
> starting from .NET 2.0 there is a nice IsNullOrEmpty static method on a
> System.String class which saves the time so instead of
>
> string theString;
>
> if ( theString != null && theString.Length > 0 )
>
> you write
>
> if ( !string.IsNullOrEmpty( theString ) )
>
> I belive that the same pattern could be adopted for arrays so that
> instead of
>
> T[] array;
>
> if ( array != null && array.Length > 0 )
>
> you could write
>
> if ( !Array.IsNullOrEmpty( array ) )
>
> Regards,
> Wiktor Zychla
>

AddThis Social Bookmark Button