Struct StringValue
Represents an option/monad item that wraps an string value and allows conversion to most common types.
public readonly struct StringValue : ICloneable, IEquatable<StringValue>, IComparable<StringValue>
- Implements
- Inherited Members
Constructors
- StringValue(string)
Creates an new empty value of the StringValue with no predefined value.
- StringValue(string, string?)
Creates an new value of the StringValue.
Properties
- IsNull
Gets an boolean indicating if this object value is null.
- IsNullOrEmpty
Gets an boolean indicating if this object value is null or an empty string.
- Name
Gets the name of the property that hosts this StringValue.
- Value
Gets the value of the current StringValue string if it has been assigned a valid underlying value.
Methods
- Create(string?)
Creates an new StringValue from the specified string.
- GetBoolean()
Gets a bool from this StringValue.
- GetByte()
Gets a byte from this StringValue.
- GetChar()
Gets a char from this StringValue. This method will throw an NullReferenceException if the value stored in this instance is null.
- GetDateTime(IFormatProvider?)
Gets a DateTime from this StringValue.
- GetDouble(IFormatProvider?)
Gets a double from this StringValue.
- GetEnum<TEnum>()
Gets an Enum object representation from this StringValue, parsing the current string expression into an value of
TEnum
. This method will throw an NullReferenceException if the value stored in this instance is null.
- GetGuid()
Gets a Guid from this StringValue.
- GetInteger()
Gets a int from this StringValue.
- GetLong()
Gets a long from this StringValue.
- GetParsable<T>(IFormatProvider?)
Gets the current value parsed by the provided IParsable<TSelf> at
T
.
- GetShort(IFormatProvider?)
Gets a short from this StringValue.
- GetSingle(IFormatProvider?)
Gets a float from this StringValue.
- GetString()
Gets a non-null string from this StringValue. This method will throw an NullReferenceException if the value stored in this instance is null.
- Get<T>(IFormatProvider?)
Gets an not null value from the specified
T
.
- MaybeNull()
Returns a self-reference to this object when it's value is not null.
- MaybeNullOrEmpty()
Returns a self-reference to this object when it's value is not null or an empty string.