Mark ITuple as public and support indexer
CreateAndInject opened this issue · 2 comments
CreateAndInject commented
Rename ITupleInternal
to ITuple
, mark it as public
and support this[]
& Length
like in .NET Framework
For example, I can't do something like this in Theraot.Core
static void Main()
{
Test(1, "han", ("aa", 1), (1, 0, "test", 1));
}
static void Test(params object[] args)
{
foreach (object obj in args)
{
if (obj is ITuple tuple)
{
for (int i = 0; i < tuple.Length; i++)
Console.WriteLine(tuple[i]);
if (tuple.Length == 2)
{
Console.WriteLine(tuple[0] is string);
Console.WriteLine(tuple[1] is int);
}
}
}
}
CreateAndInject commented
By the way, both Tuple and ValueTuple should implement ITuple
CreateAndInject commented
Merged in my own project