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

Posted by Rajnilari2015 under VB.NET category on | Points: 40 | Views : 318
The below will do so -

Public NotInheritable Class ClassExtensions
Private Sub New()
End Sub

<System.Runtime.CompilerServices.Extension> _
Public Shared Function GetProperDispCode(s As String) As String
Return If(String.IsNullOrWhiteSpace(s), String.Empty, s)
End Function
End Class

Comments or Responses

Login to post response