Since C# 7 introduces value tuples, is there a meaningful scenario where they are better suited than tuples?
For example, the following line
collection.S
There are various differences between anonymous types and C# 7 tuples, which may or may not make one more appropriate than the other in certain situations:
ValueTuple<>
s. That means they are value types while anonymous types are reference types.ItemN
(for numbers N
). The labels are just metadata information that is mostly used by the compiler, and is not persisted with the actual tuple object.(int, int)
tuple for a size would be fully compatible to an (int, int)
tuple for a position, while anonymous types are closed off completely.