NullableStringExtensions extension

Extension on String? to add utility methods.

This extension provides two methods:

  • isNullOrEmpty: a getter that checks if the string is null or empty.
  • orDefault: a method that returns the string if it's not null, otherwise it returns a default value.
on

Properties

hasValue bool

Available on String?, provided by the NullableStringExtensions extension

Checks if the string is not null or empty.
no setter
isNullOrEmpty bool

Available on String?, provided by the NullableStringExtensions extension

Checks if the string is null or empty.
no setter

Methods

orDefault(String defaultValue) String

Available on String?, provided by the NullableStringExtensions extension

Returns the string if it's not null, otherwise it returns a default value.