Sorting a Dictionary on a List of Keys

Kees C. Bakker
Oct 13, 2018 · 2 min read
We have a dictionary with objects with the color as key.
Now we would like to sort the objects in the same order as the list of colors.
Note: not all colors are in the list.

Building a KeyComparer

The result

Check how new key/value items are added to both dictionaries.
The content of the dictionaries are listed in the [key, value] format.

Getting some extensions


wehkamp-techblog

We'll try to keep up and post on the stuff we're doing and discovering. Interesting in working @wehkamp? Check out https://werkenbij.wehkamp.nl/

Kees C. Bakker

Written by

I work as a Lead Developer for one of the biggest web-shops in the Netherlands: wehkamp. I ❤️ C# and I like to solve nifty problems.

wehkamp-techblog

We'll try to keep up and post on the stuff we're doing and discovering. Interesting in working @wehkamp? Check out https://werkenbij.wehkamp.nl/