Apr 09, 2020 12:55 PM|mgebhard|LINK
The error is very clear. Your code is trying index into a LINQ Query (IQueryable). If you take few moments to review your code, you are executing the query but you don't assign the query results to a variable. You continue to use the IQueryable type
on the for loop.
Fix your code to capture the LINQ results.
creationsdate = creationsdate.OrderByDescending(r => r.CreationDate);
creationslike = creationslike.OrderByDescending(r => r.CreationAddLike + r.CreationLikes.Select(l => l.User).Count());
List<Creation> cdate = creationsdate.ToList();
List<Creation> clist = creationslike.ToList();
int creationscount = cdate.Count();
List<Creation> list1 = new List<Creation>();
for (int i = 0; i < creationscount; i++)
I recommend learning how to use the Visual Studio debugger to single step through code and watch the variables. The watch window will show the types that you are working with and should be very clear that you are NOT working with a collection.
I also recommend that you stop using the "var" keyword and use the explicit type. This will help you keep track of the types you are using.