title: Can i use pop3client to download only the newestm essages for example only the 5 newest messages?
body: <p>Now it's downloading all the messages and i have a lot of them on the server of my internet account. Then after i'm downloading all the messages it will download only the newest messages. But i wonder if i wanted on the first time instead of downloading all the messages to download only the newest 5 messages only ? Or the newest 100 messages only ? And not all the messages on the server.</p>
  
  <pre><code>using (var client = new Pop3Client())
                  {
                      client.Connect(textServer.Text, Convert.ToInt32(textPort.Text), ssl);
                      client.AuthenticationMechanisms.Remove("XOAUTH2");
                      client.Authenticate(textUser.Text, textPassword.Text);
  
                      var uids = client.GetMessageUids();
  
                      for (int i = 0; i &lt; client.Count; i++)
                      {
                          if (backgroundWorker1.CancellationPending)
                          {
                              e.Cancel = true;
                              return;
                          }
                          if (!downloaded.Contains(uids[i]))
                          {
                              allMessages.Add(client.GetMessage(i));
                              newmsg = client.GetMessage(i);
                              downloaded.Add(uids[i]);
                              SaveFullMessage(client.GetMessage(i), i);
                              w = new StreamWriter(emailsIDSFile, true);
                              w.WriteLine(uids[i]);
                              w.Close();
                          }
  
                          int nProgress = (client.Count - i + 1) * 100 / client.Count;
                          backgroundWorker1.ReportProgress(nProgress,newmsg);//, client.Count.ToString() + "/" + i);
                          newmsg = null;
                      }
  
                      client.Disconnect(true);
                  }
  </code></pre>
  
  <p>I'm getting a List of all the messages Uids:</p>
  
  <pre><code>var uids = client.GetMessageUids();
  </code></pre>
  
  <p>And i wonder if i could somehow to do something like in logical: Download only the newest 5 Uids messages or the newest 100 Uids messages. I wonder how and if i can select from the Uids List only the newest 5 or 100 messages to be downloaded.</p>
  
  <p>I don't need and don't care for now about all the messages on the server i want to check only for the N newest messages for example 5 or 100 newest messages.</p>