The help of Visual C# doesn't give an example of using the ArrayList's ToArray method. But here's one from MSDN.
Basiclly, if you have a class BinaryString, the following is right
BinaryString[] bs = (BinaryString[])anArrayList.ToArray(typeof(BinaryString));
But the following is wrong:
BinaryString[] bs = (BinaryString[])anArrayList.ToArray();
I think C# 2.0 will make it simple and easy with its feature of generic type.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment