Mega Code Archive

 
Categories / C# / Collections Data Structure
 

To get the keys alone, use the Keys property

using System; using System.Collections.Generic; public class Example {     public static void Main()     {         Dictionary<string, string> openWith = new Dictionary<string, string>();         openWith.Add("A", "a");         openWith.Add("B", "b");         openWith.Add("C", "c");         Dictionary<string, string>.KeyCollection keyColl = openWith.Keys;         Console.WriteLine();         foreach( string s in keyColl )         {             Console.WriteLine("Key = {0}", s);         }    } }