Display Linked-List in a DataGridView?

  • Thread starter Thread starter bern11
  • Start date Start date
B

bern11

How do I set a linked-list as a data source for a DataGridView control?
Should the linked list be a member on a form or its own global class
(or doesn't matter...???) Right now when I set the list as the data
source, the only columns I get are Count, First, and Last. I want data
from the nodes displayed but they are not available as columns to be added.
 
data binding generally (including DataGridView) uses the IList (or
IListSource) interface(s), which LinkedList<T> does not implement. As
such, no: this won't work "as is". It would probably be possible to
create a view around LinkedList<T> that provided this functionality
(including a typed indexer "T this[int]", and perhaps IBindingList
support), but I wonder if it is worth it... could you not just use
List<T> / BindingList<T> at this point?

Marc
 

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

Back
Top