Re: ToArray() ?

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance




"Peter Kirk" <pk@xxxxxxxxxxxxxxxxxx> wrote in message
news:u0yawFMbFHA.1404@xxxxxxxxxxxxxxxxxxxxxxx
> Hi
>
> I call a method which returns an IList containing a list of one type of
> object. How do I best convert this IList to an array?
>

You can load it into an ArrayList and uses ArrayLists.ToArray() if you
aren't worried about performance, otherwise I'd recommend writing a ToArray
implemetnation that takes an IList. Its not terribly hard to do, especially
if you know the type the list is going to be at all times.



.



Relevant Pages

  • Vector#toArray()
    ... I have a Vector which stores ... some data but I use toArray() to get the data as an Object. ... Allan ... Prev by Date: ...
    (comp.lang.java.help)
  • Re: Array casting problem
    ... You need to use the version of toArray that specifies the runtime type ... Prev by Date: ...
    (comp.lang.java.programmer)