I have just included a DLL file into my project and am using a method which returns a List<Tuple>
. I have only recently became aware of the ValueTuple
datatype in C# 7 and want to use it instead of the normal Tuples which are returned. I am aware that I could loop through and do the conversion manually however I would like to avoid doing this if possible and was wondering if anyone was aware of a shorthand way to casting a Tuple to a ValueTuple? If I am being ignorant and this isn't possible then I would be grateful if someone could make me aware of the most performant way I could achieve this conversion.
I have looked for a .ToValueTuple()
method and using a basic cast on the function returning the List with no joy.
When attempting:
List<(string entityName, int min, int average, int max)> tupTest = trs.GetEntityStats();
I receive the error:
Cannot convert source type 'System.Collections.Generic.List>' to target type 'System.Collections.Generic.List<(string entityName, int min, int average, int max)>'
question from:
https://stackoverflow.com/questions/65952783/convert-from-ienumerabletuplet1-t2-to-ienumerablet1-t2 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…