I'm finding that ValueTuples evaluate differently when I access their properties from a collection.
public static List<Tuple<string, bool>> MyTupleList = new List<Tuple<string, bool>>
{
new Tuple<string, bool>("test", true)
};
public static List<(string b, bool c)> MyList = new List<(string b, bool c)>
{
("test", true)
};
Why do these two highlighted lines evaluate differently and how can I change "MyList[0].c" to get the value correctly?
This seems to be a bug in Visual Studio 2017.
There are a few related bugs mentioned on Roslyn's github issue tracker, e.g.:
List<Tuple>
properly - which is still open but seems to be fixed (when accessing the value as Item1
), see Rango's comment.Since the issue tracker of Visual Studio is not public, we can only wait and hope that these bugs get fixed.