Is there a way to allow a list of tuples to deconstruct to a List<T>?
I get the following compile error with the following code sample:
Cannot implicitly convert type 'System.Collections.Generic.List< Deconstruct.Test>' to 'System.Collections.Generic.List<(int, int)>'
using System;
using System.Collections.Generic;
namespace Deconstruct
{
class Test
{
public int A { get; set; } = 0;
public int B { get; set; } = 0;
public void Deconstruct(out int a, out int b)
{
a = this.A;
b = this.B;
}
}
class Program
{
static void Main(string[] args)
{
var test = new Test();
var (a, b) = test;
var testList = new List<Test>();
var tupleList = new List<(int, int)>();
tupleList = testList; // ERROR HERE....
}
}
}