How to convert from ArrayList to array in .net?
I have a class idnamepair which contains 2 members, int id and String^ name;
I have a ArrayList created with this class's objects.
How can I convert it to array?
Other Answers:
Here's how in C#.
ArrayList MyArrayList = new ArrayList();
MyArrayList.Add( new idnamepair() ); //added first instance of your class
MyArrayList.Add( new idnamepair() ); //added another instance of your class
idnamepair[] MyArray;
MyArray = MyArrayList.ToArray( typeof(idnamepair) );
hope this helps
ArrayList MyArrayList = new ArrayList();
MyArrayList.Add( new idnamepair() ); //added first instance of your class
MyArrayList.Add( new idnamepair() ); //added another instance of your class
idnamepair[] MyArray;
MyArray = MyArrayList.ToArray( typeof(idnamepair) );
hope this helps
0 коммент.:
Post a Comment