I intend populating variable newOutput with my query result in the method below and return a newOutput to these method's caller. Please fix the population problem.
Code:
// public method that uses LINQ Query to reorder these class's lists
public List<string> Reordering(List<string> listToReorder)
{
//LINQ used to reorder listToReorder collections
var reordered =
from item in listToReorder
orderby item descending // arrange query in descending order
select item;
List<string> newOutput = new List<string>();
//These where my problem begins
foreach (var item in reordered)
{
for (int i = 0; i < reordered.Count(); i++)
{
newOutput[i] = item;
}
}
return newOutput; // return reordered to caller as List<string> type
}