While setting WCF client service configuration, there is an option "collection type" which defaults to "System.Array". If I change it to "Generic List", is there any performance loss?
+10
A:
Over the wire (WCF) there is no difference; the same data will be sent.
At the client, there is very little noticeable performance between List<T>
and T[]
in most scenarios. Use List<T>
- it is much easier to get it right (adding etc). If you are doing lots of data-binding, BindingList<T>
might be useful, but you might want to restrict that to a view-model, not a business object. That does have extra cost (with the events etc).
Edit: the biggest "performance cost" will be the time you spend fighting it to add items to arrays (with resize, and the cost there-of); so jump to List<T>
and smile ;-p
Marc Gravell
2009-08-04 11:06:20
List is basically Array with some management methods taking care of resizing it. That is the overhead.
Dykam
2009-08-04 11:28:07
But this "overhead" can also be a blessing if you are sequentially adding items, since it leaves spare capacity by default (doubling).
Marc Gravell
2009-08-04 11:47:18