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 System.Int32
or a System.String can be represented as Output<int, string>
. The Input<T> version of this is InputUnion<T0, T1>.
Implements
System.IEquatable<
Union<T0, T1>>
Inherited Members
System.Object.Equals(System.Object, System.Object)
System.Object.GetType()
System.Object.ReferenceEquals(System.Object, System.Object)
Assembly: Pulumi.dll
Syntax
public readonly struct Union<T0, T1> : IEquatable<Union<T0, T1>>
Type Parameters
Properties
View Source
AsT0
Declaration
public readonly T0 AsT0 { get; }
Property Value
View Source
AsT1
Declaration
public readonly T1 AsT1 { get; }
Property Value
View Source
IsT0
Declaration
public readonly bool IsT0 { get; }
Property Value
Type |
Description |
System.Boolean |
|
View Source
IsT1
Declaration
public readonly bool IsT1 { get; }
Property Value
Type |
Description |
System.Boolean |
|
View Source
Value
Declaration
public readonly object Value { get; }
Property Value
Type |
Description |
System.Object |
|
Methods
View Source
Bimap<TResult0, TResult1>(Func<T0, TResult0>, Func<T1, TResult1>)
Declaration
public readonly Union<TResult0, TResult1> Bimap<TResult0, TResult1>(Func<T0, TResult0> mapFunc0, Func<T1, TResult1> mapFunc1)
Parameters
Type |
Name |
Description |
System.Func<T0, TResult0> |
mapFunc0 |
|
System.Func<T1, TResult1> |
mapFunc1 |
|
Returns
Type |
Description |
Union<TResult0, TResult1> |
|
Type Parameters
Name |
Description |
TResult0 |
|
TResult1 |
|
View Source
Equals(Union<T0, T1>)
Declaration
public readonly bool Equals(Union<T0, T1> union)
Parameters
Type |
Name |
Description |
Union<T0, T1> |
union |
|
Returns
Type |
Description |
System.Boolean |
|
View Source
Equals(Object)
Declaration
public override readonly bool Equals(object obj)
Parameters
Type |
Name |
Description |
System.Object |
obj |
|
Returns
Type |
Description |
System.Boolean |
|
Overrides
System.ValueType.Equals(System.Object)
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 readonly int GetHashCode()
Returns
Type |
Description |
System.Int32 |
|
Overrides
System.ValueType.GetHashCode()
View Source
MapT0<TResult>(Func<T0, TResult>)
Declaration
public readonly Union<TResult, T1> MapT0<TResult>(Func<T0, TResult> mapFunc)
Parameters
Type |
Name |
Description |
System.Func<T0, TResult> |
mapFunc |
|
Returns
Type |
Description |
Union<TResult, T1> |
|
Type Parameters
View Source
MapT1<TResult>(Func<T1, TResult>)
Declaration
public readonly Union<T0, TResult> MapT1<TResult>(Func<T1, TResult> mapFunc)
Parameters
Type |
Name |
Description |
System.Func<T1, TResult> |
mapFunc |
|
Returns
Type |
Description |
Union<T0, TResult> |
|
Type Parameters
View Source
Match<TResult>(Func<T0, TResult>, Func<T1, TResult>)
Declaration
public readonly TResult Match<TResult>(Func<T0, TResult> f0, Func<T1, TResult> f1)
Parameters
Type |
Name |
Description |
System.Func<T0, TResult> |
f0 |
|
System.Func<T1, TResult> |
f1 |
|
Returns
Type Parameters
View Source
Switch(Action<T0>, Action<T1>)
Declaration
public readonly void Switch(Action<T0> f0, Action<T1> f1)
Parameters
Type |
Name |
Description |
System.Action<T0> |
f0 |
|
System.Action<T1> |
f1 |
|
View Source
ToString()
Declaration
public override readonly string ToString()
Returns
Type |
Description |
System.String |
|
Overrides
System.ValueType.ToString()
View Source
TryPickT0(out T0, out T1)
Declaration
public readonly bool TryPickT0(out T0 value, out T1 remainder)
Parameters
Type |
Name |
Description |
T0 |
value |
|
T1 |
remainder |
|
Returns
Type |
Description |
System.Boolean |
|
View Source
TryPickT1(out T1, out T0)
Declaration
public readonly bool TryPickT1(out T1 value, out T0 remainder)
Parameters
Type |
Name |
Description |
T1 |
value |
|
T0 |
remainder |
|
Returns
Type |
Description |
System.Boolean |
|
Operators
View Source
Implicit(T0 to Union<T0, T1>)
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(T1 to Union<T0, T1>)
Declaration
public static implicit operator Union<T0, T1>(T1 t)
Parameters
Type |
Name |
Description |
T1 |
t |
|
Returns
Type |
Description |
Union<T0, T1> |
|
Implements
System.IEquatable<T>