| Syntax and use of IsNullOrEmpty and IsNullOrWhiteSpace in csharp
Both of these will retrn he boolean values which is either true or false . Below syntax will helps you to understand use of these keywords in c#.
(1)string.IsNullOrEmpty:-From this we will check either string is null or empy if it is then it will return true. And it will checks for string references that are null or have no data.
if (string.IsNullOrEmpty(s) == true)
{
// True.
Console.WriteLine("Null or empty");
}
2)string.IsNullOrWhiteSpace:-And it will checks for string references that are null or have no white space.
bool a = string.IsNullOrWhiteSpace(" "); | | |