I need a way to create an empty IOrderedEnumerable and IEnumerable<IGrouping<string, DynamicNode>>
//above IGrouping DynamicNode gets stripped out by stackoverflow
Reason: I create 3 empty list types (IOrdered, IGrouping, IEnumerable) then based on some other information (options a user specifies such as order by create date or group by month) I then call a function on it assigning a list of said type.
(short snippet)
//DOESNT WORK THIS IS THE PART I NEED
IEnumerable<DynamicNode> baseList = Enumerable.Empty<DynamicNode>();
IOrderedEnumerable<DynamicNode> orderedList = (IOrderedEnumerable<DynamicNode>)Enumerable.Empty<DynamicNode>();
IEnumerable<IGrouping<string, DynamicNode>> groupedList = (IEnumerable<IGrouping<string, DynamicNode>>)Enumerable.Empty<DynamicNode>();
//ABOVE DOESNT WORK THIS IS THE PART I NEED
if (order)
{
if (group)
{
groupedList = returnGroupedOrderedList(nodeList, ascending, useFeatured, groupBy, orderBy);
}
else
{
orderedList = returnOrderedList(nodeList, ascending, useFeatured, orderBy);
}
}
Anyone know how to do it?
IOrderedEnumerable<DynamicNode> orderedList;
. It seems you are setting it again further down anyway. – Penelopepeneplain