C # Action <> with parameter Func <>

I have the following method, which I cannot determine the correct syntax for the call:

public T GetAndProcessDependants<C>(Func<object> aquire, 
    Action<IEnumerable<C>, Func<C, object>> dependencyAction) {}

I try to call it this way:

var obj = MyClass.GetAndProcessDependants<int>(() => DateTime.Now, 
    (() => someList, (id) => { return DoSomething(x); }) }

Edited: thanks everyone, you guys helped turn on the light bulb in my head. here is what i did:

var obj = MyClass.GetAndProcessDependants<int>(
            () => DateTime.Now,
            (list, f) => 
            {
                list = someList;
                f = id => { return DoSomething(id); };
            });

I don’t know why I even have a problem with this. This is one of those days, I think ..

THX

+5
source share
4 answers

Just looking at the description above, it looks like the call should be:

var obj = MyClass.GetAndProcessDependants<int>(() => DateTime.Now,
    (seq, fun) => { /* do something with seq and fun */ });

, Action, Func, ( ) , Func Action. , Func ( ).

+2

.

- :

(list, id) => DoSomething(...)
+3

At the moment, the function accepts only one argument when it asks for two!

You need to take a list argument like (list, id) => {}

+3
source
var obj = MyClass.GetAndProcessDependants<int>(
    () => DateTime.Now, 
    (someList, id) => DoSomething(x)
);
+2
source

All Articles