You can shorten it to:
void test( Action<ValueTuple<string, int>> fn)
{
fn(("hello", 10));
}
test(((string s, int i) t) =>
{
Console.WriteLine(t.s);
Console.WriteLine(t.i);
});
Hopefully, one day we might be able to splat the parameters from a tuple to the method invocation:
void test(Action<ValueTuple<string, int>> fn)
{
fn(@("hello", 10)); // <-- made up syntax
}
test((s, i) =>
{
Console.WriteLine(s);
Console.WriteLine(i);
});
But not at the moment.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…