HV-Lima Peru

Offshore your .NET/SQL Development to Latin America! Languages: en-de-es

Monthly Archives: May 2010

How to Linq ListBoxes with Except

There is a cool way to query ListBoxes with Linq.

Imagine there are three ListBoxes:
– A: with all currencies
– B: with selected currencies
– C: with available currencies, like A:.Except(B:)

The content of the visible ListBoxes is like:

For better comprehension I’ve created two sets (that do not materialize):
– Line 253: selectedCurrencies
– Line 255: allCurrencies

The resulting availableCurrencies are built in line 257…

…and materialized at the arrow