0

I want to create a Freezable that contains a Dictionary as one DependencyProperty. So I think I need a freezable Dictionary because it must not be changed when the Freezable gets frozen... or am I wrong? If so what do I really have to do?

HerpDerpington
  • 3,751
  • 4
  • 27
  • 43
  • 1
    Is it an option for you to just use an `ILookup` instead of a `Dictionary`? It's immutable. – Servy Sep 30 '13 at 19:27
  • Yes, it would be an option for accessing the entries; but then how do I set the values? – HerpDerpington Sep 30 '13 at 19:33
  • You call `ToLookup` on some other data structure or `IEnumerable` that has all of the needed information. – Servy Sep 30 '13 at 19:34
  • Right, but I hoped there would be an easier solution... – HerpDerpington Sep 30 '13 at 19:35
  • You can create your own implementation of the interface if there is some other method more amenable to your particular application. There are no other concrete implementations in the BCL. – Servy Sep 30 '13 at 19:37

1 Answers1

0

Even though it is possible to use a Lookup, I finally ended up writing a FreezableDictionary so that I do not get IEnumerables as I would using a Lookup. It uses a simple Dictionary as a backing.

HerpDerpington
  • 3,751
  • 4
  • 27
  • 43