© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•4y ago•
10 replies
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);
}
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
The name 'Bar' does not exist in the current context
on the second line? Why is this?
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources
Recent Announcements

Similar Threads

Was this page helpful?

Similar Threads

✅ Downloading file with HttpClient does not work
C#CC# / help
14mo ago
❔ Optional does not work with C# protobufs
C#CC# / help
3y ago
Edit function does not work
C#CC# / help
15mo ago
why does this Not work?
C#CC# / help
3y ago