I want to use a method like this one:
public void A(Action<Action<string>> x)
{
for (int i = 0; i < 10; i++)
{
x.Invoke(data => {
Console.WriteLine($"{data} --- {i}");
});
}
}
The idea here is that the user (of this method) will input another method which can generate a string from a data source of preference.
Let's say I want to provide the user with some built-in solutions as static methods:
public void B(string fileName, Action<string> y)
{
// process fileName
string data = C(fileName);
// invoke inner action
y.Invoke(data);
}
The use case would be:
A(B("/home/user1"));
The problem with this is B still needs another argument for fileName
How do I do that?