pnmcosta

I don't know if this is the right forum to make a suggestion could you direct me to where i should post this message

Loads of times i find myself Trimming a string to remove white spaces to check if it is empty or not with String.IsNullOrEmpty, is it possible to have a second method implementation that will trim the string for us e.g. String.IsNullOrEmpty(string value, bool trim)


Re: Visual C# Express Edition String.IsNullOrEmpty suggestion

DMan1

Code Snippet

public bool IsStringEmpty(string value, bool trim)

{

if (trim)

{

value.Trim;

return String.IsNullOrEmpty(value);

}

else

{

return String.IsNullOrEmpty(value);

}

}






Re: Visual C# Express Edition String.IsNullOrEmpty suggestion

pnmcosta

Hi DMan1,

I appreciate your code snippet but i had done that myself on a static util class, my argument is that this should be part of the framework String utility functions.

It's just a simple thing, that would not affect in anyway if it was implemented, possibly in the soon to come frmwk 3..

Regards,




Re: Visual C# Express Edition String.IsNullOrEmpty suggestion

SDAVILA604

I think in ORCA you'll be able to add any method to any class, without deriving from it, even if you did not create the class yourself. You should be able to do exactly what you want...

-Sergio