lundi 28 juin 2021

how to add parameters Func<> [duplicate]

I am trying to create a class that represents a function how can such a thing be achieved ??

i try to use this

public class Function : Value
{
    Func<Value, Value> Fun;

    public Function(Func<Value, Value> fun)
    {
        Fun = fun;
    }

    public override Value Execute(IEnumerable<Value> args)
    {
        if(args.Count() == 1)
            Fun(args.First());
        return Number.Empty;
    }
}

but i realy need in the constructor some think like this

Func<...Args> Fun;

public Function(Func<...Args> fun)
{
    Fun = fun;
}




Aucun commentaire:

Enregistrer un commentaire