What type of collection should I use for best performance?

When configuring the WCF client service, there is a "collection type" option, which defaults to "System.Array". If I change it to General List, is there any performance loss?

+6
performance c # wcf
source share
1 answer

By wire (WCF) there is no difference; the same data will be sent.

On the client, in most scenarios there are very few noticeable characteristics between List<T> and T[] . Use List<T> - it is much easier to do it right (add, etc.). If you are doing a lot of data binding, a BindingList<T> may be useful, but you can restrict it to a view, not a business object. This has an additional cost (with events, etc.).


Edit: the biggest "cost of execution" is the time taken to deal with it in order to add elements to arrays (with resizing and cost); so jump on List<T> and smile; -p

+11
source share

All Articles