I am attempting to add data to a list of a class...so basically the program is looping thru a rss feed and I need to add a few things from the feed to a List<DownloadManager> where the DownloadManager is a class I have created....I create a list at the class level with this - List<DownloadManager> listDM = new List<DownloadManager>();
this code works...except it adds the same data over and over ....not sure why....it is in a foreach loop...so my thinkin is everytime it goes thru the loop it should add the NEW data?
see code below
thank you for any help
-InkedGFX
this code works...except it adds the same data over and over ....not sure why....it is in a foreach loop...so my thinkin is everytime it goes thru the loop it should add the NEW data?
see code below
try { WebClient client = new WebClient(); foreach (string link in links) { string url = link; XmlDocument xmlDoc = new XmlDocument(); xmlDoc.Load(link); XmlElement root = xmlDoc.DocumentElement; XmlNodeList nodes = root.SelectNodes("channel/item"); foreach (XmlNode node in nodes) { if (node != null) { DownloadManager dm = new DownloadManager(); dm.ItemTitle = node["title"].InnerText; dm.Links = node["link"].InnerText; dm.Description = node["description"].InnerText; string description = dm.Description; string[] seperator = { " ", "src=" }; string Value = description; string[] imagelink = Value.Split(seperator, StringSplitOptions.None); string imagelink_final = imagelink[2].Replace('"', ' ').Trim(); ImageLink.Add(imagelink[2].Replace('"', ' ').Trim()); listDM.Add(new DownloadManager { ItemTitle = dm.ItemTitle, Description = dm.Description, Links = dm.Links });
thank you for any help
-InkedGFX
Last edited: