Struct Union<T0, T1>
Represents a Tagged Union.
This is used to hold a value that could take on several different, but fixed, types. Only
one of the types can be in use at any one time. It can be thought of as a type that has
several "cases," each of which should be handled correctly when that type is manipulated.
For example, a
Resource property that could either store a
int
or a
string can be represented as
Output<int, string>
. The
Input<T> version of this is
InputUnion<T0, T1>.
Assembly: Pulumi.dll
Syntax
public readonly struct Union<T0, T1> : IEquatable<Union<T0, T1>>
Type Parameters
Properties
View Source
AsT0
Declaration
Property Value
View Source
AsT1
Declaration
Property Value
View Source
IsT0
Declaration
public bool IsT0 { get; }
Property Value
View Source
IsT1
Declaration
public bool IsT1 { get; }
Property Value
View Source
Value
Declaration
public object Value { get; }
Property Value
Methods
View Source
Bimap<TResult0, TResult1>(Func<T0, TResult0>, Func<T1, TResult1>)
Declaration
public Union<TResult0, TResult1> Bimap<TResult0, TResult1>(Func<T0, TResult0> mapFunc0, Func<T1, TResult1> mapFunc1)
Parameters
Type |
Name |
Description |
Func<T0, TResult0> |
mapFunc0 |
|
Func<T1, TResult1> |
mapFunc1 |
|
Returns
Type |
Description |
Union<TResult0, TResult1> |
|
Type Parameters
Name |
Description |
TResult0 |
|
TResult1 |
|
View Source
Equals(Union<T0, T1>)
Declaration
public bool Equals(Union<T0, T1> union)
Parameters
Type |
Name |
Description |
Union<T0, T1> |
union |
|
Returns
View Source
Equals(object?)
Declaration
public override bool Equals(object? obj)
Parameters
Type |
Name |
Description |
object |
obj |
|
Returns
Overrides
View Source
FromT0(T0)
Declaration
public static Union<T0, T1> FromT0(T0 input)
Parameters
Type |
Name |
Description |
T0 |
input |
|
Returns
Type |
Description |
Union<T0, T1> |
|
View Source
FromT1(T1)
Declaration
public static Union<T0, T1> FromT1(T1 input)
Parameters
Type |
Name |
Description |
T1 |
input |
|
Returns
Type |
Description |
Union<T0, T1> |
|
View Source
GetHashCode()
Declaration
public override int GetHashCode()
Returns
Overrides
View Source
MapT0<TResult>(Func<T0, TResult>)
Declaration
public Union<TResult, T1> MapT0<TResult>(Func<T0, TResult> mapFunc)
Parameters
Type |
Name |
Description |
Func<T0, TResult> |
mapFunc |
|
Returns
Type |
Description |
Union<TResult, T1> |
|
Type Parameters
View Source
MapT1<TResult>(Func<T1, TResult>)
Declaration
public Union<T0, TResult> MapT1<TResult>(Func<T1, TResult> mapFunc)
Parameters
Type |
Name |
Description |
Func<T1, TResult> |
mapFunc |
|
Returns
Type |
Description |
Union<T0, TResult> |
|
Type Parameters
View Source
Match<TResult>(Func<T0, TResult>, Func<T1, TResult>)
Declaration
public TResult Match<TResult>(Func<T0, TResult> f0, Func<T1, TResult> f1)
Parameters
Type |
Name |
Description |
Func<T0, TResult> |
f0 |
|
Func<T1, TResult> |
f1 |
|
Returns
Type Parameters
View Source
Switch(Action<T0>, Action<T1>)
Declaration
public void Switch(Action<T0> f0, Action<T1> f1)
Parameters
View Source
ToString()
Declaration
public override string ToString()
Returns
Overrides
View Source
TryPickT0(out T0, out T1)
Declaration
public bool TryPickT0(out T0 value, out T1 remainder)
Parameters
Type |
Name |
Description |
T0 |
value |
|
T1 |
remainder |
|
Returns
View Source
TryPickT1(out T1, out T0)
Declaration
public bool TryPickT1(out T1 value, out T0 remainder)
Parameters
Type |
Name |
Description |
T1 |
value |
|
T0 |
remainder |
|
Returns
Operators
View Source
implicit operator Union<T0, T1>(T0)
Declaration
public static implicit operator Union<T0, T1>(T0 t)
Parameters
Type |
Name |
Description |
T0 |
t |
|
Returns
Type |
Description |
Union<T0, T1> |
|
View Source
implicit operator Union<T0, T1>(T1)
Declaration
public static implicit operator Union<T0, T1>(T1 t)
Parameters
Type |
Name |
Description |
T1 |
t |
|
Returns
Type |
Description |
Union<T0, T1> |
|
Implements