Where possible use string object method IsNullOrWhiteSpace() instead of IsNullOrEmpty() in C#

Typical situation for bug is when developer processes string input and not check for possible whitespaces value. Where possible use method IsNullOrWhiteSpace() instead of IsNullOrEmpty(). This method additonaly checks if string contains only whitespaces. Often it is not desirable value for string.


String.IsNullOrWhiteSpace Method (String) (System) – MSDN

C# string.IsNullOrWhiteSpace Method – Dot Net Perls

Leave a Reply

Your email address will not be published. Required fields are marked *