Search Results for

Show / Hide Table of Contents

# Struct SerializableOptional<T>

Represents Nullable<T> for simple value types.

##### Implements

IEquatable<SerializableOptional<T>>

##### Inherited Members

ValueType.ToString()
object.Equals(object, object)
object.GetType()
object.ReferenceEquals(object, object)

###### Namespace: AppstockSDK.Api

###### Assembly: Appstock.Core.dll

##### Syntax

    [Serializable]
    public struct SerializableOptional<T> : IEquatable<SerializableOptional<T>> where T : struct

##### Type Parameters

Name | Description
--- | ---
T | Type of potentially contained value.

##### Remarks

Custom property drawer included.

### Fields

#### enabled

Gets or sets if value is present.

##### Declaration

    public bool enabled

##### Field Value

Type | Description
--- | ---
bool | `true` if value is the value of whole property, `false` if the whole property is `null`.

#### value

Gets or sets value of internal container.

##### Declaration

    public T value

##### Field Value

Type | Description
--- | ---
T | Value container for when enabled is `true`.

##### Remarks

Ignored if enabled is `false`.

### Methods

#### Equals(SerializableOptional<T>)

Indicates whether the current object is equal to another object of the same type.

##### Declaration

    public readonly bool Equals(SerializableOptional<T> other)

##### Parameters

Type | Name | Description
--- | --- | ---
SerializableOptional<T> | other | An object to compare with this object.

##### Returns

Type | Description
--- | ---
bool | true if the current object is equal to the `other` parameter; otherwise, false.

#### Equals(object?)

Indicates whether this instance and a specified object are equal.

##### Declaration

    public override readonly bool Equals(object? obj)

##### Parameters

Type | Name | Description
--- | --- | ---
object | obj | The object to compare with the current instance.

##### Returns

Type | Description
--- | ---
bool | true if `obj` and this instance are the same type and represent the same value; otherwise, false.

##### Overrides

ValueType.Equals(object)

#### GetHashCode()

Returns the hash code for this instance.

##### Declaration

    public override readonly int GetHashCode()

##### Returns

Type | Description
--- | ---
int | A 32-bit signed integer that is the hash code for this instance.

##### Overrides

ValueType.GetHashCode()

### Operators

#### explicit operator T?(SerializableOptional<T>)

Converts SerializableOptional<T> to a Nullable<T>.

##### Declaration

    public static explicit operator T?(SerializableOptional<T> optional)

##### Parameters

Type | Name | Description
--- | --- | ---
SerializableOptional<T> | optional | The SerializableOptional<T> to convert.

##### Returns

Type | Description
--- | ---
T? | The converted Nullable<T>.

#### implicit operator SerializableOptional<T>(T?)

Converts Nullable<T> to a SerializableOptional<T>.

##### Declaration

    public static implicit operator SerializableOptional<T>(T? nullableValue)

##### Parameters

Type | Name | Description
--- | --- | ---
T? | nullableValue | The Nullable<T> to convert.

##### Returns

Type | Description
--- | ---
SerializableOptional<T> | The converted SerializableOptional<T>.

### Implements

IEquatable<T>