Class Chain<T>
Defines an implementation for a chain of objects.
Inheritance
System.Object
Chain<T>
Implements
IChain<T>
Namespace: MADE.Runtime.Actions
Assembly: MADE.Runtime.dll
Syntax
public class Chain<T> : object, IChain<T> where T : class
Type Parameters
Name | Description |
---|---|
T | The type of object being chained. |
Constructors
| Improve this Doc View SourceChain(T)
Initializes a new instance of the Chain<T> class with an instance.
Declaration
public Chain(T instance)
Parameters
Type | Name | Description |
---|---|---|
T | instance | The instance to begin the chain. |
Chain(IEnumerable<T>)
Initializes a new instance of the Chain<T> class with a collection of instances.
Declaration
public Chain(IEnumerable<T> instances)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<T> | instances | The instances to begin the chain. |
Methods
| Improve this Doc View SourceInvoke(Action<T>)
Invokes an action with the chain.
Declaration
public void Invoke(Action<T> func)
Parameters
Type | Name | Description |
---|---|---|
Action<T> | func | The action to invoke. |
InvokeAsync(Func<T, Task>)
Invokes an asynchronous action with the chain.
Declaration
public async Task InvokeAsync(Func<T, Task> func)
Parameters
Type | Name | Description |
---|---|---|
Func<T, Task> | func | The asynchronous action to invoke. |
Returns
Type | Description |
---|---|
Task | An asynchronous operation. |
With(T)
Concatenates the current instances in the chain with the specified instance.
Declaration
public Chain<T> With(T instance)
Parameters
Type | Name | Description |
---|---|---|
T | instance | The instance to chain. |
Returns
Type | Description |
---|---|
Chain<T> | The updated Chain<T>. |
With(IEnumerable<T>)
Concatenates the current instances in the chain with the specified instances.
Declaration
public Chain<T> With(IEnumerable<T> instances)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<T> | instances | The instances to chain. |
Returns
Type | Description |
---|---|
Chain<T> | The updated Chain<T>. |