For example I have
private void test(Action> fn)
{
fn((\"hello\", 10));
}
test(t =>
{
var (s, i) = t;
C
Here are more concise syntax variations that don't require any extra imports. No, it does not resolve wishes for "splatter" syntax discussed in comments, but no other answer used the ValueTuple syntax for the initial parameter definition.
void test(Action<(string, int)> fn)
{
fn(("hello", 10));
}
// OR using optional named ValueTuple arguments
void test(Action<(string word, int num)> fn)
{
fn((word: "hello", num: 10));
}
The invocation using a lambda expression is not that verbose, and the ValueTuple components can still be retrieved using minimal syntax:
test( ((string, int) t) => {
var (s, i) = t;
Console.WriteLine(s);
Console.WriteLine(i);
});