Early Preview
This is currently very much a preview. Please feel free to try things out,
but don't be upset if anything is not yet working. Feedback is welcome over on our
GitHub Dicussions page.
struct System.​Nullable`1
Assembly: System.Runtime
Represents a value type that can be assigned <see langword="null" /> .
Properties
public
bool
HasValue
Gets a value indicating whether the current <see cref="T:System.Nullable`1" /> object has a valid value of its underlying type.
public
T
Value
Gets the value of the current <see cref="T:System.Nullable`1" /> object if it has been assigned a valid underlying value.
Methods
public
bool
Equals​(object other)
other
An object.
Returns <see langword="true" /> if the <paramref name="other" /> parameter is equal to the current <see cref="T:System.Nullable`1" /> object; otherwise, <see langword="false" /> .
This table describes how equality is defined for the compared values:
<list type="table">
<listheader>
<term> Return Value</term>
<description> Description</description>
</listheader>
<item>
<term>
<see langword="true" />
</term>
<description> The <see cref="P:System.Nullable`1.HasValue" /> property is <see langword="false" />, and the <paramref name="other" /> parameter is <see langword="null" /> (that is, two null values are equal by definition), OR the <see cref="P:System.Nullable`1.HasValue" /> property is <see langword="true" />, and the value returned by the <see cref="P:System.Nullable`1.Value" /> property is equal to the <paramref name="other" /> parameter.</description>
</item>
<item>
<term>
<see langword="false" />
</term>
<description> The <see cref="P:System.Nullable`1.HasValue" /> property for the current <see cref="T:System.Nullable`1" /> structure is <see langword="true" />, and the <paramref name="other" /> parameter is <see langword="null" />, OR the <see cref="P:System.Nullable`1.HasValue" /> property for the current <see cref="T:System.Nullable`1" /> structure is <see langword="false" />, and the <paramref name="other" /> parameter is not <see langword="null" />, OR the <see cref="P:System.Nullable`1.HasValue" /> property for the current <see cref="T:System.Nullable`1" /> structure is <see langword="true" />, and the value returned by the <see cref="P:System.Nullable`1.Value" /> property is not equal to the <paramref name="other" /> parameter.</description>
</item>
</list>
Indicates whether the current <see cref="T:System.Nullable`1" /> object is equal to a specified object.
public
int
GetHashCode​() Returns The hash code of the object returned by the <see cref="P:System.Nullable`1.Value" /> property if the <see cref="P:System.Nullable`1.HasValue" /> property is <see langword="true" /> , or zero if the <see cref="P:System.Nullable`1.HasValue" /> property is <see langword="false" /> .
Retrieves the hash code of the object returned by the <see cref="P:System.Nullable`1.Value" /> property.
public
T
GetValueOrDefault​() Returns The value of the <see cref="P:System.Nullable`1.Value" /> property if the <see cref="P:System.Nullable`1.HasValue" /> property is <see langword="true" /> ; otherwise, the default value of the underlying type.
Retrieves the value of the current <see cref="T:System.Nullable`1" /> object, or the default value of the underlying type.
public
string
ToString​() Returns The text representation of the value of the current <see cref="T:System.Nullable`1" /> object if the <see cref="P:System.Nullable`1.HasValue" /> property is <see langword="true" /> , or an empty string ("") if the <see cref="P:System.Nullable`1.HasValue" /> property is <see langword="false" /> .
Returns the text representation of the value of the current <see cref="T:System.Nullable`1" /> object.
protected
void
Finalize​()
Inherited from object
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
public
Type
GetType​()
Inherited from object
Returns The exact runtime type of the current instance.
Gets the <see cref="T:System.Type" /> of the current instance.
protected
object
MemberwiseClone​()
Inherited from object
Returns A shallow copy of the current <see cref="T:System.Object" /> .
Creates a shallow copy of the current <see cref="T:System.Object" /> .