Represents a value type that can be assigned null
.
More...
|
| Nullable (T value) |
| Initializes a new instance of the T:System.Nullable`1 structure to the specified value. More...
|
|
T | GetValueOrDefault () |
| Retrieves the value of the current T:System.Nullable`1 object, or the object's default value. More...
|
|
T | GetValueOrDefault (T defaultValue) |
| Retrieves the value of the current T:System.Nullable`1 object, or the specified default value. More...
|
|
override bool | Equals (object other) |
| Indicates whether the current T:System.Nullable`1 object is equal to a specified object. More...
|
|
override int | GetHashCode () |
| Retrieves the hash code of the object returned by the P:System.Nullable`1.Value property. More...
|
|
override string | ToString () |
| Returns the text representation of the value of the current T:System.Nullable`1 object. More...
|
|
|
static implicit | operator T? (T value) |
| Creates a new T:System.Nullable`1 object initialized to a specified value. More...
|
|
static | operator T (T? value) |
| Defines an explicit conversion of a T:System.Nullable`1 instance to its underlying value. More...
|
|
static int | Compare< T > (T? n1, T? n2) |
| Compares the relative values of two T:System.Nullable`1 objects. More...
|
|
static bool | Equals< T > (T? n1, T? n2) |
| Indicates whether two specified T:System.Nullable`1 objects are equal. More...
|
|
static Type | GetUnderlyingType (Type nullableType) |
| Returns the underlying type argument of the specified nullable type. More...
|
|
|
bool | HasValue [get] |
| Gets a value indicating whether the current T:System.Nullable`1 object has a valid value of its underlying type. More...
|
|
T | Value [get] |
| Gets the value of the current T:System.Nullable`1 object if it has been assigned a valid underlying value. More...
|
|
Represents a value type that can be assigned null
.
Supports a value type that can be assigned null
. This class cannot be inherited.
- Template Parameters
-
T | The underlying value type of the T:System.Nullable`1 generic type. |
Definition at line 12 of file Nullable.cs.
◆ Nullable()
Initializes a new instance of the T:System.Nullable`1 structure to the specified value.
- Parameters
-
Definition at line 53 of file Nullable.cs.
◆ Compare< T >()
Compares the relative values of two T:System.Nullable`1 objects.
- Parameters
-
n1 | A T:System.Nullable`1 object. |
n2 | A T:System.Nullable`1 object. |
- Template Parameters
-
T | The underlying value type of the n1 and n2 parameters. |
- Returns
- An integer that indicates the relative values of the n1 and n2 parameters.Return ValueDescriptionLess than zeroThe P:System.Nullable`1.HasValue property for n1 is
false
, and the P:System.Nullable`1.HasValue property for n2 is true
.-or-The P:System.Nullable`1.HasValue properties for n1 and n2 are true
, and the value of the P:System.Nullable`1.Value property for n1 is less than the value of the P:System.Nullable`1.Value property for n2 .ZeroThe P:System.Nullable`1.HasValue properties for n1 and n2 are false
.-or-The P:System.Nullable`1.HasValue properties for n1 and n2 are true
, and the value of the P:System.Nullable`1.Value property for n1 is equal to the value of the P:System.Nullable`1.Value property for n2 .Greater than zeroThe P:System.Nullable`1.HasValue property for n1 is true
, and the P:System.Nullable`1.HasValue property for n2 is false
.-or-The P:System.Nullable`1.HasValue properties for n1 and n2 are true
, and the value of the P:System.Nullable`1.Value property for n1 is greater than the value of the P:System.Nullable`1.Value property for n2 .
Definition at line 160 of file Nullable.cs.
◆ Equals()
Indicates whether the current T:System.Nullable`1 object is equal to a specified object.
- Parameters
-
- Returns
true
if the other parameter is equal to the current T:System.Nullable`1 object; otherwise, false
. This table describes how equality is defined for the compared values: Return ValueDescription true
The P:System.Nullable`1.HasValue property is false
, and the other parameter is null
. That is, two null values are equal by definition.-or-The P:System.Nullable`1.HasValue property is true
, and the value returned by the P:System.Nullable`1.Value property is equal to the other parameter. false
The P:System.Nullable`1.HasValue property for the current T:System.Nullable`1 structure is true
, and the other parameter is null
.-or-The P:System.Nullable`1.HasValue property for the current T:System.Nullable`1 structure is false
, and the other parameter is not null
.-or-The P:System.Nullable`1.HasValue property for the current T:System.Nullable`1 structure is true
, and the value returned by the P:System.Nullable`1.Value property is not equal to the other parameter.
Definition at line 91 of file Nullable.cs.
◆ Equals< T >()
Indicates whether two specified T:System.Nullable`1 objects are equal.
- Parameters
-
n1 | A T:System.Nullable`1 object. |
n2 | A T:System.Nullable`1 object. |
- Template Parameters
-
T | The underlying value type of the n1 and n2 parameters. |
- Returns
true
if the n1 parameter is equal to the n2 parameter; otherwise, false
. The return value depends on the P:System.Nullable`1.HasValue and P:System.Nullable`1.Value properties of the two parameters that are compared.Return ValueDescription true
The P:System.Nullable`1.HasValue properties for n1 and n2 are false
. -or-The P:System.Nullable`1.HasValue properties for n1 and n2 are true
, and the P:System.Nullable`1.Value properties of the parameters are equal. false
The P:System.Nullable`1.HasValue property is true
for one parameter and false
for the other parameter.-or-The P:System.Nullable`1.HasValue properties for n1 and n2 are true
, and the P:System.Nullable`1.Value properties of the parameters are unequal.
Definition at line 189 of file Nullable.cs.
◆ GetHashCode()
Retrieves the hash code of the object returned by the P:System.Nullable`1.Value property.
- Returns
- The hash code of the object returned by the P:System.Nullable`1.Value property if the P:System.Nullable`1.HasValue property is
true
, or zero if the P:System.Nullable`1.HasValue property is false
.
Definition at line 107 of file Nullable.cs.
◆ GetUnderlyingType()
Returns the underlying type argument of the specified nullable type.
- Parameters
-
nullableType | A T:System.Type object that describes a closed generic nullable type. |
- Returns
- The type argument of the nullableType parameter, if the nullableType parameter is a closed generic nullable type; otherwise,
null
.
- Exceptions
-
T:System.ArgumentNullException | nullableType is null . |
Definition at line 212 of file Nullable.cs.
◆ GetValueOrDefault() [1/2]
Retrieves the value of the current T:System.Nullable`1 object, or the object's default value.
- Returns
- The value of the P:System.Nullable`1.Value property if the P:System.Nullable`1.HasValue property is
true
; otherwise, the default value of the current T:System.Nullable`1 object. The type of the default value is the type argument of the current T:System.Nullable`1 object, and the value of the default value consists solely of binary zeroes.
Definition at line 63 of file Nullable.cs.
◆ GetValueOrDefault() [2/2]
Retrieves the value of the current T:System.Nullable`1 object, or the specified default value.
- Parameters
-
defaultValue | A value to return if the P:System.Nullable`1.HasValue property is false . |
- Returns
- The value of the P:System.Nullable`1.Value property if the P:System.Nullable`1.HasValue property is
true
; otherwise, the defaultValue parameter.
Definition at line 73 of file Nullable.cs.
◆ operator T()
Defines an explicit conversion of a T:System.Nullable`1 instance to its underlying value.
- Parameters
-
- Returns
- The value of the P:System.Nullable`1.Value property for the value parameter.
Definition at line 143 of file Nullable.cs.
◆ operator T?()
Creates a new T:System.Nullable`1 object initialized to a specified value.
- Parameters
-
- Returns
- A T:System.Nullable`1 object whose P:System.Nullable`1.Value property is initialized with the value parameter.
Definition at line 133 of file Nullable.cs.
◆ ToString()
Returns the text representation of the value of the current T:System.Nullable`1 object.
- Returns
- The text representation of the value of the current T:System.Nullable`1 object if the P:System.Nullable`1.HasValue property is
true
, or an empty string ("") if the P:System.Nullable`1.HasValue property is false
.
Definition at line 119 of file Nullable.cs.
◆ HasValue
Gets a value indicating whether the current T:System.Nullable`1 object has a valid value of its underlying type.
- Returns
true
if the current T:System.Nullable`1 object has a value; false
if the current T:System.Nullable`1 object has no value.
Definition at line 23 of file Nullable.cs.
◆ Value
Gets the value of the current T:System.Nullable`1 object if it has been assigned a valid underlying value.
- Returns
- The value of the current T:System.Nullable`1 object if the P:System.Nullable`1.HasValue property is
true
. An exception is thrown if the P:System.Nullable`1.HasValue property is false
.
- Exceptions
-
T:System.InvalidOperationException | The P:System.Nullable`1.HasValue property is false . |
Definition at line 37 of file Nullable.cs.
The documentation for this class was generated from the following file: