I see in the API Dictionary has a ToArray() method (in the extension classes area), but when I try to use this from my Dictionary instance it can't see it???
How do I "enable" ToArray() for my Dictionary instance?
Thanks
The Dictonary<TKey,TValue>
class does not actually have a .ToArray
method. There is an extension method called .ToArray
which can bind to Dictionary<TKey,TValue>
. But this requires that System.Linq be one of your usings.
Have you verified that System.Linq is imported?
Example:
using System.Linq;
...
public void Example() {
var map = new Dictionary<string,string>();
..
var arr = map.ToArray();
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With