Possible Duplicate:
string.IsNullOrEmpty() vs string.NotNullOrEmpty()
Can someone explain to me why in .NET I would write String.IsNullOrEmpty(str)
instead of str.IsNullOrEmpty()
? There must be a logical reason but I don't know it.
It sounds like you guys are saying
- You can't call methods from objects that are null in C#/.NET (I do it in C++, it just doesnt access any member vars)
- Extension methods didn't exist in .NET 2.0
- Microsoft didn't bother to update the standards and probably felt it was insignificant