Can the new feature in C# 7.0 (in VS 2017) to give tuple fields names be translated to KeyValuePairs?
Lets assume I have this:
class Entry
{
public string SomeProperty { get; set; }
}
var allEntries = new Dictionary<int, List<Entry>>();
// adding some keys with some lists of Entry
It would be nice to do something like:
foreach ((int collectionId, List<Entry> entries) in allEntries)
I have already added System.ValueTuple
to the project.
Being able to write it like that would be much better than this traditional style:
foreach (var kvp in allEntries)
{
int collectionId = kvp.Key;
List<Entry> entries = kvp.Value;
}
allEntries
is, which makes it really hard to try to help... – NorsemanDictionary<int, string>
as well. – DemolishDictionary<,>
is a good start - you hadn't mentioned that before. I think it would be simpler if you rewrote the question with a minimal reproducible example usingDictionary<int, string>
though. I'll have a look in a bit... – Norseman