I have method which return List and I wanna try to populate ValueTuple from another standard list I get error:
Cannot implicitly convert type 'System.Collections.Generic.List<(long PaymentId, long TransactionId)>' to 'System.Collections.Generic.List>'
The code looks like below:
public async Task<List<ValueTuple<(long, long)>>> CreditTransactionAsync(CancellationToken cancellationToken)
{
List<(long PaymentId, long TransactionId)> paymentTransactionList = new List<ValueTuple<long, long>>();
var paymentTransactions = _dbContext.PaymentTransactions
.AsEnumerable()
.Where(x => transactionIdsList.Any(a => a.TransactionId == x.TransactionId))
.Select(x => new
{
PaymentId = x.PaymentId,
TransactionId = x.TransactionId
})
.ToList();
// This line shows error..
paymentTransactionList = paymentTransactions.Select(x => (PaymentId: x.PaymentId, TransactionId: x.TransactionId));
return paymentTransactionList;
}