Paging can be done like this:
int pageSize = 500;
for (int i = 1; i <= imap.CurrentFolder.TotalMessageCount; i += pageSize)
{
var page = new ImapMessageSet();
page.AddRange(i, i + pageSize - 1);
var list = imap.Search(page, ImapListFields.UniqueId, ImapSearchParameter.Not(ImapSearchParameter.Deleted));
// do something with messages ...
}
Please note this paging limits input collection, not output collection. It means that if you have pageSize = 500, the resulting list will contain 500 or less messages.