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 -

python - ValueError: No axis named 1 for object type <class 'pandas.core.series.Series'> -

java - How to provide dependency injections in Eclipse RCP 3.x? -