Sample Code:
string fetchXMLInvoice = @"<fetch version='1.0' page='{0}' paging-cookie='{1}' count='5000' output-format='xml-platform' mapping='logical' distinct='false'>
<entity name='tec_invoice'>
<attribute name='tec_invoiceid' />
<attribute name='tec_name' />
<attribute name='createdon' />
<order attribute='tec_name' descending='false' />
<filter type='and'>
<condition attribute='createdon' operator='on-or-after' value='2017-01-01' />
<condition attribute='createdon' operator='on-or-before' value='2018-01-01' />
</filter>
</entity>
</fetch>";
int page = 1;
string pageCookies = "";
EntityCollection result = new EntityCollection();
do
{
var fetchXML= new FetchExpression(String.Format(fetchXMLInvoice, page++, pageCookies));
result = service.RetrieveMultiple(fetchXML);
pageCookies = System.Net.WebUtility.HtmlEncode(result.PagingCookie);
} while (result.MoreRecords);