ImmutableDictionary has no constructors defined
Posted
by
lukasLansky
on Stack Overflow
See other posts from Stack Overflow
or by lukasLansky
Published on 2014-06-04T09:22:33Z
Indexed on
2014/06/04
9:24 UTC
Read the original article
Hit count: 129
c#
|immutability
So, I would like to write something like this:
var d = new ImmutableDictionary<string, int> { { "a", 1 }, { "b", 2 } };
(using ImmutableDictionary from System.Collections.Immutable). It seems like a straightforward usage as I am declaring all the values upfront -- no mutation there. But this gives me error:
The type 'System.Collections.Immutable.ImmutableDictionary<TKey,TValue>' has no constructors defined
How I am supposed to create a new immutable dictionary with static content?
© Stack Overflow or respective owner