BindingList projection wrapper

Posted by Groo on Stack Overflow See other posts from Stack Overflow or by Groo
Published on 2010-03-03T08:59:58Z Indexed on 2010/04/27 12:33 UTC
Read the original article Hit count: 390

Filed under:
|
|
|
|

Is there a simple way to create a BindingList wrapper (with projection), which would update as the original list updates?

For example, let's say I have a mutable list of numbers, and I want to represent them as hex strings in a ComboBox. Using this wrapper I could do something like this:

BindingList<int> numbers = data.GetNumbers();
comboBox.DataSource = Project(numbers, i => string.Format("{0:x}", i));

I could wrap the list into a new BindingList, handle all source events, update the list and fire these events again, but I feel that there is a simpler way already.

© Stack Overflow or respective owner

Related posts about .NET

Related posts about c#