BasePropertyValueOrStringEmpty Method
A simple helper method that will return String.Empty if the specified string value is null.
If not null, it returns the string value.
Namespace: EWSoftware.PDI.PropertiesAssembly: EWSoftware.PDI.Data (in EWSoftware.PDI.Data.dll) Version: 2023.1.2.0
public static string ValueOrStringEmpty(
string propertyValue
)
Public Shared Function ValueOrStringEmpty (
propertyValue As String
) As String
public:
static String^ ValueOrStringEmpty(
String^ propertyValue
)
static member ValueOrStringEmpty :
propertyValue : string -> string
- propertyValue String
- The property value string to check
StringThe property value if not null or
String.Empty if the value is null
This may be useful if you would prefer not to have to always check for null values in
string-type properties before using a string method that may throw an exception if it is null (i.e.
Length).
string country = BaseProperty.ValueOrStringEmpty(vCard.Address.Country);
// No need to check for null first
if(country.Length != 0)
// ... Do something with the country value ...
Dim country As String = BaseProperty.ValueOrStringEmpty(vCard.Address.Country)
' No need to check for null first
If country.Length <> 0 Then
' ... Do something with the country value ...
End If
No code example is currently available or this language may not be supported.
No code example is currently available or this language may not be supported.