Show / Hide Table of Contents

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>.

Implements
IEquatable<Union<T0, T1>>
Inherited Members
object.Equals(object, object)
object.GetType()
object.ReferenceEquals(object, object)
Namespace: Pulumi
Assembly: Pulumi.dll
Syntax
public readonly struct Union<T0, T1> : IEquatable<Union<T0, T1>>
Type Parameters
Name Description
T0
T1

Properties

View Source

AsT0

Declaration
public T0 AsT0 { get; }
Property Value
Type Description
T0
View Source

AsT1

Declaration
public T1 AsT1 { get; }
Property Value
Type Description
T1
View Source

IsT0

Declaration
public bool IsT0 { get; }
Property Value
Type Description
bool
View Source

IsT1

Declaration
public bool IsT1 { get; }
Property Value
Type Description
bool
View Source

Value

Declaration
public object Value { get; }
Property Value
Type Description
object

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>)

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

Declaration
public bool Equals(Union<T0, T1> other)
Parameters
Type Name Description
Union<T0, T1> 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.

View Source

Equals(object?)

Indicates whether this instance and a specified object are equal.

Declaration
public override 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)
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()

Returns the hash code for this instance.

Declaration
public override int GetHashCode()
Returns
Type Description
int

A 32-bit signed integer that is the hash code for this instance.

Overrides
ValueType.GetHashCode()
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
Name Description
TResult
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
Name Description
TResult
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 Description
TResult
Type Parameters
Name Description
TResult
View Source

Switch(Action<T0>, Action<T1>)

Declaration
public void Switch(Action<T0> f0, Action<T1> f1)
Parameters
Type Name Description
Action<T0> f0
Action<T1> f1
View Source

ToString()

Returns the fully qualified type name of this instance.

Declaration
public override string ToString()
Returns
Type Description
string

The fully qualified type name.

Overrides
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
bool
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
bool

Operators

View Source

operator ==(Union<T0, T1>, Union<T0, T1>)

Declaration
public static bool operator ==(Union<T0, T1> left, Union<T0, T1> right)
Parameters
Type Name Description
Union<T0, T1> left
Union<T0, T1> right
Returns
Type Description
bool
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>
View Source

operator !=(Union<T0, T1>, Union<T0, T1>)

Declaration
public static bool operator !=(Union<T0, T1> left, Union<T0, T1> right)
Parameters
Type Name Description
Union<T0, T1> left
Union<T0, T1> right
Returns
Type Description
bool

Implements

IEquatable<T>

Version 3.106.2

  • View Source
Back to top Copyright 2016-2023, Pulumi Corporation.