Warum ist diese Methode so langsam?C#

Ein Treffpunkt für C#-Programmierer
Guest
 Warum ist diese Methode so langsam?

Post by Guest »

Ich habe eine Methode zur Paginierung von Datensätzen.

Code: Select all

public static IEnumerable Paginate(IEnumerable records, int count, int page,
out int? nextPage, out int? previousPage, out int from, out int to, bool canScroll = true)
{
nextPage = null;
previousPage = null;
if (!canScroll)
{
from = 1;
to = count;
return records.Take(count);
}

if (page > 0)
{
previousPage = page - 1;
}
if (records.Count() > (page + 1) * count)
{
nextPage = page + 1;
}

var listed = records.Skip(count * page).Take(count);
from = count * page + 1;
to = count * page + listed.Count();
return listed;
}
< /code>
records
Parameter ist EF, wobei () Ergebnis. Wie kann ich es behindern?

Quick Reply

Change Text Case: 
   
  • Similar Topics
    Replies
    Views
    Last post