Assuming you are using .NET 3.5 or later ( using System.Linq; ):
string[] keys = dictionary.Keys.ToArray();
Otherwise, you will have to use the CopyTo method or use a loop:
string[] keys = new string[dictionary.Keys.Count]; dictionary.Keys.CopyTo(keys, 0);
Thomas Levesque Oct 25 '09 at 16:43 2009-10-25 16:43
source share