c# - how can we do reverse iteration of last four items in the XmlNodeList -


at point displaying items in reverse order no limit. xmlnodelist can have many items. display last 4 items. how can find or display last 4 items in list? anyone?

xmlnodelist mytestlist = myrssdocument.selectnodes("test/holder/item");  string title = ""; string link = "";   (int = mytestlist.count - 1; >= 0; i--) {     xmlnode mytestdetail;      mytestdetail = mytestlist.item(i).selectsinglenode("title");     if (mytestdetail != null)         title = mytestdetail.innertext;     else         title = "";      mytestdetail = mytestlist.item(i).selectsinglenode("link");     if (mytestdetail != null)         link = mytestdetail.innertext;     else         link = ""; } 

you can replace following line:

for (int = mytestlist.count - 1; >= 0; i--) 

by this:

for (int = mytestlist.count - 1; >= (mytestlist.count - 4) ; i--) 

Comments

Popular posts from this blog

'hasOwnProperty' in javascript -

c# - Update a combobox from a presenter (MVP) -

android - Unable to generate FCM token from dynamically instantiated Firebase -