string.IsNullOrEmpty(string) vs. string.IsNullOrWhiteSpace(string)

后端 未结 9 735
广开言路
广开言路 2020-11-28 03:02

Is use of string.IsNullOrEmpty(string) when checking a string considered as bad practice when there is string.IsNullOrWhiteSpace(string) in .NET 4.

9条回答
  •  我在风中等你
    2020-11-28 03:24

    They are different functions. You should decide for your situation what do you need.

    I don't consider using any of them as a bad practice. Most of the time IsNullOrEmpty() is enough. But you have the choice :)

提交回复
热议问题