Hi...
I have a fixed size array in my program.....
but in order to make the program memory efficient....
i want to make it an ArrayList...
can someone please explain how to do this.....
i have posted my code below...
class StaticColumn
{
public TextBox[] textBoxes = new TextBox[1000];
public void getDetails(XmlNode node)
{
XmlElement nodeAsElement = node as XmlElement;
XmlNodeList _list = nodeAsElement.GetElementsByTagName("Textbox");
int i=0;
foreach (XmlNode tempNode in _list)
{
textBoxes[i] = new TextBox();
textBoxes[i].getDetails(tempNode);
i++;
}
}
}
class TextBox
{
public string name = string.Empty;
public string value = string.Empty;
public string visibility = string.Empty;
public Navigation navigation = new Navigation();
public void getDetails(XmlNode node)
{
XmlElement nodeAsElement = node as XmlElement;
try { name = node.Attributes["Name"].InnerText.ToString(); }
catch (NullReferenceException e) { }
try { value = nodeAsElement.GetElementsByTagName("Value")[0].InnerText.ToString(); }
catch (NullReferenceException e) { }
try { visibility = nodeAsElement.GetElementsByTagName("Visibility")[0].InnerText.ToString(); }
catch (NullReferenceException e) { }
try { visibility = nodeAsElement.GetElementsByTagName("Hidden")[0].InnerText.ToString(); }
catch (NullReferenceException e) { }
try
{
navigation = new Navigation();
node = nodeAsElement.GetElementsByTagName("Drillthrough")[0];
navigation.getDetails(node);
}
catch (NullReferenceException e) { navigation = null; }
}
public void getElements(XmlNode node)
{
XmlElement nodeAsElement = node as XmlElement;
try { name = node.Attributes["Name"].InnerText.ToString(); }
catch (NullReferenceException e) { }
try { visibility = nodeAsElement.GetElementsByTagName("Visibility")[0].FirstChild.InnerText.ToString(); }
catch (NullReferenceException e) { }
//try { visibility = nodeAsElement.GetElementsByTagName("Hidden")[0].InnerText.ToString(); }
//catch (NullReferenceException e) { }
try
{
navigation = new Navigation();
node = nodeAsElement.GetElementsByTagName("Drillthrough")[0];
navigation.getDetails(node);
}
catch (NullReferenceException e) { navigation = null; }
try
{
nodeAsElement = (XmlElement)nodeAsElement.GetElementsByTagName("Paragraphs")[0];
XmlNodeList _list1 = nodeAsElement.GetElementsByTagName("Value");
foreach (XmlNode tempNode in _list1)
{
value = value + tempNode.InnerText.ToString();
}
}
catch (NullReferenceException e) { }
}
}
i also want to know how to read from the new class .. Because i'm sure the changes would also affect the reading...