Sisk

Struct

StringValue

Namespace
Sisk.Core.Entity
Assembly
Sisk.Core.dll

Represents an option/monad item that wraps an string value and allows conversion to most common types.

C#
public readonly struct StringValue : ICloneable, IEquatable<StringValue>, IComparable<StringValue>

Implements #

ICloneable, IEquatable<StringValue>, IComparable<StringValue>

Inherited Members #

object.GetType(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()

Constructors #

NameDescription
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 #

NameDescription
IsNullGets an boolean indicating if this object value is null.
IsNullOrEmptyGets an boolean indicating if this object value is null or an empty string.
NameGets the name of the property that hosts this StringValue.
ValueGets the value of the current StringValue string if it has been assigned a valid underlying value.

Methods #

NameDescription
Clone()
CompareTo(StringValue, in StringComparison)Compares the current object with another object of the same type, using the specified string comparison.
Create(string?)Creates an new StringValue from the specified string.
Get<T>(IFormatProvider?)Parses the value contained in this StringValue as a type T that implements IParsable. Throws an exception if the value couldn’t be parsed to the target type.
GetBoolean()Parses the value contained in this StringValue as a Boolean. Throws an exception if the value couldn’t be parsed to the target type.
GetByte(IFormatProvider?)Parses the value contained in this StringValue as a Byte. Throws an exception if the value couldn’t be parsed to the target type.
GetChar()Parses the value contained in this StringValue as a Char. Throws an exception if the value couldn’t be parsed to the target type.
GetDateTime(IFormatProvider?)Parses the value contained in this StringValue as a DateTime. Throws an exception if the value couldn’t be parsed to the target type.
GetDecimal(IFormatProvider?)Parses the value contained in this StringValue as a Decimal. Throws an exception if the value couldn’t be parsed to the target type.
GetDouble(IFormatProvider?)Parses the value contained in this StringValue as a Double. Throws an exception if the value couldn’t be parsed to the target type.
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(IFormatProvider?)Parses the value contained in this StringValue as a Guid. Throws an exception if the value couldn’t be parsed to the target type.
GetInteger(IFormatProvider?)Parses the value contained in this StringValue as an Int32. Throws an exception if the value couldn’t be parsed to the target type.
GetLong(IFormatProvider?)Parses the value contained in this StringValue as a Int64. Throws an exception if the value couldn’t be parsed to the target type.
GetShort(IFormatProvider?)Parses the value contained in this StringValue as a Int16. Throws an exception if the value couldn’t be parsed to the target type.
GetSingle(IFormatProvider?)Parses the value contained in this StringValue as a Single. Throws an exception if the value couldn’t be parsed to the target type.
GetString()Gets a non-null string from this StringValue. This method will throw an NullReferenceException if the value stored in this instance is null.
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.

Type to search the documentation and the API reference.