Encapsulation of value-type parsing that mirrors the Nullable<T> "interface".
Directly assign a System.String value to a Parsed<T> to initiate parsing of the string. If successful, Parsed<T>.HasValue will be true
and Parsed<T>.Value will return the parsed T value.
[Serializable]
public struct Parsed<T> : IComparable<Parsed<T>>
where T: struct
- T
- The underlying value type to parse to.
Type: System.String
Gets or sets the string to be parsed into a <T> value.
Type: System.Boolean
Gets a value indicating whether the current Parsed<T> object has a valid value of its underlying type.
Type: T
Gets the value of the current Parsed<T> object if it has been assigned a valid underlying value or parsable string.
Name | Condition |
---|---|
InvalidOperationException | The HasValue property is false. |