DefaultableInt32 Struct
Provides a representation for an int that can be defaulted.
[TypeConverter(typeof(DefaultableInt32Converter))]
public struct DefaultableInt32
Constructors
DefaultableInt32(int)
Initializes a new instance of the DefaultableInt32
structure.
public DefaultableInt32(int value)
Parameter | Type | Description |
---|---|---|
value | int | The integer value of the structure. |
Properties
Default
Gets the DefaultableInt32 that represents a default value.
public static DefaultableInt32 Default { get; }
Property Value
- DefaultableInt32:
The DefaultableInt32 that represents a default value.
IsDefault
Gets whether the value of the structure is flagged as a default.
public bool IsDefault { get; }
Property Value
- bool:
true
if the value of the structure is flagged as a default; otherwise,false
.
Value
Gets the value of the structure.
Methods
Equals(object)
Determines whether the specified Object
is equal to the current Object
.
public override bool Equals(object obj)
Parameter | Type | Description |
---|---|---|
obj | object | The |
Returns
- bool:
true
if the specifiedObject
is equal to the currentObject
; otherwise,false
.
GetHashCode()
Returns a hash code for this object.
public override int GetHashCode()
Returns
- int:
An integer value that specifies a hash value for this object.
Operators
operator ==(DefaultableInt32, DefaultableInt32)
Compares two objects for equality.
public static bool operator ==(DefaultableInt32 left, DefaultableInt32 right)
Parameter | Type | Description |
---|---|---|
left | DefaultableInt32 | A DefaultableInt32 to compare. |
right | DefaultableInt32 | A DefaultableInt32 to compare. |
Returns
- bool:
true
if the values ofleft
andright
are equal; otherwise,false
.
explicit operator int(DefaultableInt32)
Explicitly converts a DefaultableInt32 to an int.
public static explicit operator int(DefaultableInt32 value)
Parameter | Type | Description |
---|---|---|
value | DefaultableInt32 | The DefaultableInt32 to convert. |
Returns
implicit operator DefaultableInt32(int)
Implicitly converts an int to a DefaultableInt32.
public static implicit operator DefaultableInt32(int value)
Parameter | Type | Description |
---|---|---|
value | int | The int to convert. |
Returns
- DefaultableInt32:
The DefaultableInt32 that was created.
operator !=(DefaultableInt32, DefaultableInt32)
Compares two objects for inequality.
public static bool operator !=(DefaultableInt32 left, DefaultableInt32 right)
Parameter | Type | Description |
---|---|---|
left | DefaultableInt32 | A DefaultableInt32 to compare. |
right | DefaultableInt32 | A DefaultableInt32 to compare. |
Returns
- bool:
true
if the values ofleft
andright
are unequal; otherwise,false
.