다음을 통해 공유


SumType<T1,T2,T3> Struct

Definition

Struct that may contain a T1, a T2, or a T3.

generic <typename T1, typename T2, typename T3>
public value class SumType : IEquatable<Microsoft::VisualStudio::LanguageServer::Protocol::SumType<T1, T2, T3>>, Microsoft::VisualStudio::LanguageServer::Protocol::ISumType
[Newtonsoft.Json.JsonConverter(typeof(Microsoft.VisualStudio.LanguageServer.Protocol.SumConverter))]
public struct SumType<T1,T2,T3> : IEquatable<Microsoft.VisualStudio.LanguageServer.Protocol.SumType<T1,T2,T3>>, Microsoft.VisualStudio.LanguageServer.Protocol.ISumType
[<Newtonsoft.Json.JsonConverter(typeof(Microsoft.VisualStudio.LanguageServer.Protocol.SumConverter))>]
type SumType<'T1, 'T2, 'T3> = struct
    interface ISumType
Public Structure SumType(Of T1, T2, T3)
Implements IEquatable(Of SumType(Of T1, T2, T3)), ISumType

Type Parameters

T1

The first type this struct is designed to contain.

T2

The second type this struct is designed to contain.

T3

The third type this struct is designed to contain.

Inheritance
SumType<T1,T2,T3>
Attributes
Newtonsoft.Json.JsonConverterAttribute
Implements

Constructors

SumType<T1,T2,T3>(T1)

Initializes a new instance of the SumType<T1,T2,T3> struct containing a T1.

SumType<T1,T2,T3>(T2)

Initializes a new instance of the SumType<T1,T2,T3> struct containing a T2.

SumType<T1,T2,T3>(T3)

Initializes a new instance of the SumType<T1,T2,T3> struct containing a T3.

Properties

First

Gets the value as the first specified type.

Second

Gets the value as the second specified type.

Third

Gets the value as the third specified type.

Value

Gets the value stored in the SumType. This can be matched against using the "is" operator.

Methods

Equals(Object)

Indicates whether this instance and a specified object are equal.

Equals(SumType<T1,T2,T3>)

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

GetHashCode()

Returns the hash code for this instance.

Match<TResult>(Func<T1,TResult>, Func<T2,TResult>, Func<T3,TResult>, Func<TResult>)

Runs a delegate corresponding to which type is contained inside this instance.

TryGetFirst(T1)

Tries to get the value as the first specified type.

TryGetSecond(T2)

Tries to get the value as the second specified type.

TryGetThird(T3)

Tries to get the value as the third specified type.

Operators

Equality(SumType<T1,T2,T3>, SumType<T1,T2,T3>)
Explicit(SumType<T1,T2,T3> to SumType<T1,T2>)
Explicit(SumType<T1,T2,T3> to T1)

Attempts to cast an instance of SumType<T1,T2,T3> to an instance of T1.

Explicit(SumType<T1,T2,T3> to T2)

Attempts to cast an instance of SumType<T1,T2> to an instance of T2.

Explicit(SumType<T1,T2,T3> to T3)

Attempts to cast an instance of SumType<T1,T2,T3> to an instance of T3.

Implicit(SumType<T1,T2> to SumType<T1,T2,T3>)
Implicit(T1 to Nullable<SumType<T1,T2,T3>>)
Implicit(T1 to SumType<T1,T2,T3>)
Implicit(T2 to Nullable<SumType<T1,T2,T3>>)
Implicit(T2 to SumType<T1,T2,T3>)
Implicit(T3 to Nullable<SumType<T1,T2,T3>>)
Implicit(T3 to SumType<T1,T2,T3>)
Inequality(SumType<T1,T2,T3>, SumType<T1,T2,T3>)

Applies to