Class Union<TFirst, TSecond>
Represents the union of two types, TFirst and TSecond. Used
in scenarios where an OpenSearch API may accept more than one different input data structure.
Inheritance
Inherited Members
Namespace: OpenSearch.Client
Assembly: OpenSearch.Client.dll
Syntax
public class Union<TFirst, TSecond>
Type Parameters
| Name | Description |
|---|---|
| TFirst | The first type |
| TSecond | The second type |
Constructors
| Edit this page View SourceUnion(TFirst)
Creates an new instance of Union<TFirst, TSecond> that encapsulates item value
Declaration
public Union(TFirst item)
Parameters
| Type | Name | Description |
|---|---|---|
| TFirst | item | The value to encapsulate |
Union(TSecond)
Creates an new instance of Union<TFirst, TSecond> that encapsulates item value
Declaration
public Union(TSecond item)
Parameters
| Type | Name | Description |
|---|---|---|
| TSecond | item | The value to encapsulate |
Methods
| Edit this page View SourceMatch(Action<TFirst>, Action<TSecond>)
Runs an Action<T> delegate against the encapsulated value
Declaration
public void Match(Action<TFirst> first, Action<TSecond> second)
Parameters
| Type | Name | Description |
|---|---|---|
| Action<TFirst> | first | The delegate to run when this instance encapsulates an instance of |
| Action<TSecond> | second | The delegate to run when this instance encapsulates an instance of |
Match<T>(Func<TFirst, T>, Func<TSecond, T>)
Runs a Func<T, TResult> delegate against the encapsulated value
Declaration
public T Match<T>(Func<TFirst, T> first, Func<TSecond, T> second)
Parameters
| Type | Name | Description |
|---|---|---|
| Func<TFirst, T> | first | The delegate to run when this instance encapsulates an instance of |
| Func<TSecond, T> | second | The delegate to run when this instance encapsulates an instance of |
Returns
| Type | Description |
|---|---|
| T |
Type Parameters
| Name | Description |
|---|---|
| T |
Operators
| Edit this page View Sourceimplicit operator Union<TFirst, TSecond>(TFirst)
Declaration
public static implicit operator Union<TFirst, TSecond>(TFirst first)
Parameters
| Type | Name | Description |
|---|---|---|
| TFirst | first |
Returns
| Type | Description |
|---|---|
| Union<TFirst, TSecond> |
implicit operator Union<TFirst, TSecond>(TSecond)
Declaration
public static implicit operator Union<TFirst, TSecond>(TSecond second)
Parameters
| Type | Name | Description |
|---|---|---|
| TSecond | second |
Returns
| Type | Description |
|---|---|
| Union<TFirst, TSecond> |