this question is not a duplicate of Better naming in Tuple classes than "Item1", "Item2"
In the linked Question, they ask about assigning names to tuple elements. I am asking about naming the entire type which is a tuple with named elements.
I have a tuple with named items in my code:
(string kind, string colour, string length) a = ("annual", "blue", "short);
var myKind = a.kind;
var myColour = a.blue;
var myLength = a.short;
I would like this type to be named so I can use it like this (similar to C++ typedef):
FlowerInformation a = ("annual", "blue", "short);
var myKind = a.kind;
var myColour = a.colour;
var myLength = a.length;
I could use the "using" directive, like so:
using FlowerInformation = System.ValueTuple<string , string , string>;
This way the type has a name, but the items are not named, so my code must become this:
FlowerInformation a = ("annual", "blue", "short);
var myKind = a.Item1;
var myColour = a.Item2;
var myLength = a.Item3;
What I'd really like is a named tuple type with named members. Is it possible in C#?
The following doesn't work:
using FlowerInformation = (string kind, string colour, string length);