Difference between int [] and list < Int & gt;

advertisements

What is the difference between:

    int[] myIntArray

and

 list<int> myIntArray

?

In web services I read that I should pick one or the other and not mix the two, why?


On the wire they will be indistinguishable - i.e. both Customer[] and List<Customer> are going to look (roughly) like:

<Customers>
   <Customer name="Fred" ... />
   <Customer name="Barney" ... />
</Customers>

So there is no point having logic that treats the two differently. Ultimately, int[] is a pain to work with (Add etc), so I would tend to use List<T> - of course, wsdl.exe nicely defaults to arrays, IIRC - but there is a command line switch (or perhaps there is for wse/wcf).