Hi all,
I'm writing a C# program (with Visual Studio .NET 2003 Professional), and I created an array of TreeNode objects using the simple statement:
TreeNode[] atn;
Then I created a TreeNode object with the statement
TreeNode tn = new TreeNode("test");
and I tried to add it to the array, but I discovered that there isn't a method Add: in fact, the statement
atn.Add(tn);
generates a compile error.
The strange thing is that, when I consulted the IList interface in the MSDN library (the interface that implements Add, Insert, Remove, RemoveAt and other methods), I read that it can be used from the Array class...
So, why the compiler gives me an error if I try to use the Add method to add an element to an array?
If this way isn't possible, how can I increase the dimension of a dynamic array and add an element to it?
Thank you very much
I'm writing a C# program (with Visual Studio .NET 2003 Professional), and I created an array of TreeNode objects using the simple statement:
TreeNode[] atn;
Then I created a TreeNode object with the statement
TreeNode tn = new TreeNode("test");
and I tried to add it to the array, but I discovered that there isn't a method Add: in fact, the statement
atn.Add(tn);
generates a compile error.
The strange thing is that, when I consulted the IList interface in the MSDN library (the interface that implements Add, Insert, Remove, RemoveAt and other methods), I read that it can be used from the Array class...
So, why the compiler gives me an error if I try to use the Add method to add an element to an array?
If this way isn't possible, how can I increase the dimension of a dynamic array and add an element to it?
Thank you very much