I need to keep track of how many items are in a node of this one attribute in C# and I have no idea on how to load an array, starting with 1 and ending with a variable
The code for this portion is this
//Loads file containing OSXInstaller File List
doc.Load("Distribution.xml");
XmlNodeList ChoiceNode = doc.GetElementsByTagName("choice");
foreach (XmlNode choices in ChoiceNode)
{
//Code Executed only for packages, not categories
if (choices.HasChildNodes == true)
{
choicetitle.Add(choices.Attributes["title"].InnerText);
//Counts the number of items with an attribute of "title" in the
//distributions file, so if the user selects #1 in the list box it will
//know what number one is
choicelistcount++;
}
if (choices.HasChildNodes == false)
{
}
else
{
MessageBox.Show("Your Mac OS X Installation disk is damaged or was mounted improperly, please try again and doube-check your information!");
}
}
I'm trying to get it to count the number of items with the attribute of title, then being able to print out all of the items in the list
choicetitle is the string list
I want it to look something like:
listBox1.Items.Add(choicetitle[1-choicetitlecount]);
edit: To answer some of the comments below;
I put this together in a very short time and things like spell-checking don't really matter to me
The reason why I also include an else statement is because it adds an additional check whether the OSX Install Disk was mounted
The Program is a tool to Add & Remove packages to the OSX Installer, not as in a live-cd type thing but to add packages that you can install onto your new OS X installation website is at http://osxreformer.org