I need some help with adding either a string array or list to a List<class>
what I want to do is this:
I am collecting data from a website , on this website there is a header section which has breadcrumb links..I get this data and have it in a HtmlNodeCollection header. from there I would like to add it to my Part class which I create a List<Part> ...my question is , How to add the collection from the header in the constructor of the Part class.....the Part class code is below:
the code below is how I am adding data to the List<Part>
thank you for any help
-InkedGFX
what I want to do is this:
I am collecting data from a website , on this website there is a header section which has breadcrumb links..I get this data and have it in a HtmlNodeCollection header. from there I would like to add it to my Part class which I create a List<Part> ...my question is , How to add the collection from the header in the constructor of the Part class.....the Part class code is below:
public class Part { public List<string> header = new List<string>(); //Properties public string Part_Title { get; set; } public string Part_Number { get; set; } public string List_Price { get; set; } public string Our_Price { get; set; } public string Prod_Desc { get; set; } public string Part_ImageLocation { get; set; } public string[] Header { get; set; } //Cunstructor with no arguments public Part() { } //Constructor public Part(string parTitle, string partNumber, string listPrice, string ourPrice, string prodDesc, string part_imageLocation, string[] _header) [COLOR=#FF0000]<----- Is this correct? if it is, how to add data to it?[/COLOR] { Part_Title = parTitle; Part_Number = partNumber; List_Price = listPrice; Our_Price = ourPrice; Prod_Desc = prodDesc; Part_ImageLocation = part_imageLocation; [COLOR=#FF0000]how do I add the contents of the HtmlNodeCollection to this string[] header or the List header?[/COLOR] } public override string ToString() { return Part_Title + ", " + Part_Number + ", " + List_Price + ", " + Our_Price + ", " + Prod_Desc + ", " + Part_ImageLocation; } }
the code below is how I am adding data to the List<Part>
spider.partList.Add(new Part("Part #" + validCount.ToString() + " " + partTitle, partNumber, listPrice, ourPrice, partDesc, partImageLocation, string[] header));<-[COLOR=#FF0000]--Correct or Not?[/COLOR]
thank you for any help
-InkedGFX