Table of Contents

ActionFactory Class

Definition

Namespace
Cuemon.Extensions
Assemblies
Cuemon.Extensions.Core.dll
Source
src/Cuemon.Extensions.Core/ActionFactory.cs

Provides access to factory methods for creating ActionFactory<TTuple> instances that encapsulate a delegate with a variable amount of generic arguments.

public static class ActionFactory
Inheritance
object
ActionFactory

Examples

The following example demonstrates how to create an ActionFactory from a callback with arguments and execute it. It shows both creating a factory with Create and invoking directly with Invoke.

using System;
using Cuemon;
using Cuemon.Extensions;

namespace Cuemon.Extensions;

public class ActionFactoryExample
{
    public void Demonstrate()
    {
        Action<string, int> callback = (name, count) =>
        {
            for (int i = 0; i < count; i++)
                Console.WriteLine(name);
        };

        var factory = ActionFactory.Create(callback, "Loop", 3);
        factory.ExecuteMethod();

        ActionFactory.Invoke(tuple => Console.WriteLine(tuple.Arg1), MutableTupleFactory.CreateOne("Direct invoke"));
    }
}

Methods

Name Description
Create(Action)

Creates a new ActionFactory<TTuple> instance encapsulating the specified method.

Create<T>(Action<T>, T)

Creates a new ActionFactory<TTuple> instance encapsulating the specified method and one generic argument.

Create<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(Action<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10)

Creates a new ActionFactory<TTuple> instance encapsulating the specified method and ten generic arguments.

Create<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>(Action<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11)

Creates a new ActionFactory<TTuple> instance encapsulating the specified method and eleven generic arguments.

Create<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12>(Action<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12>, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12)

Creates a new ActionFactory<TTuple> instance encapsulating the specified method and twelfth generic arguments.

Create<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13>(Action<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13>, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13)

Creates a new ActionFactory<TTuple> instance encapsulating the specified method and thirteen generic arguments.

Create<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14>(Action<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14>, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14)

Creates a new ActionFactory<TTuple> instance encapsulating the specified method and fourteen generic arguments.

Create<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15>(Action<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15>, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15)

Creates a new ActionFactory<TTuple> instance encapsulating the specified method and fifteen generic arguments.

Create<T1, T2>(Action<T1, T2>, T1, T2)

Creates a new ActionFactory<TTuple> instance encapsulating the specified method and two generic arguments.

Create<T1, T2, T3>(Action<T1, T2, T3>, T1, T2, T3)

Creates a new ActionFactory<TTuple> instance encapsulating the specified method and three generic arguments.

Create<T1, T2, T3, T4>(Action<T1, T2, T3, T4>, T1, T2, T3, T4)

Creates a new ActionFactory<TTuple> instance encapsulating the specified method and four generic arguments.

Create<T1, T2, T3, T4, T5>(Action<T1, T2, T3, T4, T5>, T1, T2, T3, T4, T5)

Creates a new ActionFactory<TTuple> instance encapsulating the specified method and five generic arguments.

Create<T1, T2, T3, T4, T5, T6>(Action<T1, T2, T3, T4, T5, T6>, T1, T2, T3, T4, T5, T6)

Creates a new ActionFactory<TTuple> instance encapsulating the specified method and six generic arguments.

Create<T1, T2, T3, T4, T5, T6, T7>(Action<T1, T2, T3, T4, T5, T6, T7>, T1, T2, T3, T4, T5, T6, T7)

Creates a new ActionFactory<TTuple> instance encapsulating the specified method and seven generic arguments.

Create<T1, T2, T3, T4, T5, T6, T7, T8>(Action<T1, T2, T3, T4, T5, T6, T7, T8>, T1, T2, T3, T4, T5, T6, T7, T8)

Creates a new ActionFactory<TTuple> instance encapsulating the specified method and eight generic arguments.

Create<T1, T2, T3, T4, T5, T6, T7, T8, T9>(Action<T1, T2, T3, T4, T5, T6, T7, T8, T9>, T1, T2, T3, T4, T5, T6, T7, T8, T9)

Creates a new ActionFactory<TTuple> instance encapsulating the specified method and nine generic arguments.

Invoke<TTuple>(Action<TTuple>, TTuple)

Invokes the specified delegate method with a n-tuple argument.