Extension method to check if a string is Null/Empty/WhiteSpace. If it has value then return that else return default value using C#?

Rajnilari2015
Posted by Rajnilari2015 under C# category on | Points: 40 | Views : 1347
The below will do so -

public static class ClassExtensions
{

public static string GetProperDispCode(this string s)
{
return string.IsNullOrWhiteSpace(s) ? string.Empty : s;
}
}

Comments or Responses

Login to post response