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 struct Union<T0, T1> : IEquatable<Union<T0, T1>>, IUnion
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
| Type |
Description |
| System.Boolean |
|
View Source
IsT1
Declaration
public bool IsT1 { get; }
Property Value
| Type |
Description |
| System.Boolean |
|
View Source
Value
Declaration
public object Value { get; }
Property Value
| Type |
Description |
| System.Object |
|
Methods
View Source
Equals(Union<T0, T1>)
Declaration
public 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 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 int GetHashCode()
Returns
| Type |
Description |
| System.Int32 |
|
Overrides
System.ValueType.GetHashCode()
View Source
MapT0<TResult>(Func<T0, TResult>)
Declaration
public 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 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 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 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 string ToString()
Returns
| Type |
Description |
| System.String |
|
Overrides
System.ValueType.ToString()
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
| Type |
Description |
| System.Boolean |
|
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
| 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>