Я знаю, что мы можем объявить именованные кортежи, например:
var name = (first:"Sponge", last:"Bob");
Однако Я не могу понять, как объединить именованный кортеж с универсальным типом c, таким как Словарь .
Я испробовал следующие варианты, но не повезло:
Dictionary<string, (string, string)> name = new Dictionary<string, (string, string)>();
// this assignment yields this message:
// The tuple element name 'value' is ignored because a different name or no name is specified by the
// target type '(string, string)'.
// The tuple element name 'limitType' is ignored because a different name or no name is specified
// by the target type '(string, string)'.
name["cast"] = (value:"Sponge", limitType:"Bob");
// I tried putting the name in front and at the end of the type, but no luck
// Both statements below produce syntactic error:
Dictionary<string, (value:string, string)> name;
Dictionary<string, (string:value, string)> name;
Кто-нибудь знает, поддерживает ли C# сценарий выше?