C#C
C#3y ago
palapapa

✅ `with` expression does not work with `ValueTuple`

This code:
Foo foo = new();
Foo foo1 = foo with { Bar.Item1 = 1 };

record Foo
{
    public (int, int) Bar = (0, 0);
}

Gives The name 'Bar' does not exist in the current context on the second line? Why is this?
Was this page helpful?