list vs bindinglist

G

Guest

Hi all,

I am developing a bunch of custom business objects and to hold collections I
am using the BindingList(of ) generic collection. Now I know that will come
useful if I want to directly bind that data to databound controls. If I dont
ever have such a need, would I see a significant performance improvement if
I moved it to a List(of ) generic collection?

TIA!
 
P

Peter Huang [MSFT]

Hi

Here are two links about generics.
Commonly generic will get the performance improvement.

Performance The bottom line is this: if type checking is done at compile
time rather than at run time, performance improves. In managed code, casts
between references and values incur both boxings and unboxings, and
avoiding such casts can have an equally negative impact on performance.
Current benchmarks of a quick-sort of an array of one million integers
shows the generic method is three times faster than the non-generic
equivalent. This is because boxing of the values is avoided completely. The
same sort over an array of string references resulted in a 20 percent
improvement in performance with the generic method due to the absence of a
need to perform type checking at run time.

http://msdn.microsoft.com/msdnmag/issues/03/10/NET/

http://msdn.microsoft.com/msdnmag/issues/03/09/NET/


Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
 
G

Guest

I understand that. But in my scenario I am debating between using
BindingList(of) vs List(of). Are there any significant performance gains I
will get if I went with List(of) and sacrificed the functionality gains of
BindingList(of) ?

Thanks!
 
P

Peter Huang [MSFT]

Hi

Yes, since the BindingList will do more job, so it will be somewhat slower
than the list. But I think it will not get much performance improvement.

Collections and Data Binding
http://msdn.microsoft.com/msdnmag/issues/05/05/CuttingEdge/

Also recently, commonly we need the new feature of bindinglist compared to
list in ASP.NET, Winform, if you would do that now or in the further, I
suggest you use the BindingList.
Anyway, if you do care the performance and will not use the BindingList's
feature, you can use the List.

Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top