The names of the values are not part of ValueTuple<...>
.
The names are maintained by the compiler and attributes are added when they need to be communicated to outside code.
Check it out on sharplab.io.
This:
namespace Test
{
static class TestClass
{
static (int a, int b) test = (1, 0);
static void v()
{
var a = test.a;
var b = test.b;
_ = (a, b);
}
}
}
will be translated into this:
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Security;
using System.Security.Permissions;
namespace Test
{
internal static class TestClass
{
[TupleElementNames(new string[] {
"a",
"b"
})]
private static ValueTuple<int, int> test = new ValueTuple<int, int>(1, 0);
private static void v()
{
int item2 = test.Item1;
int item = test.Item2;
}
}
}