G
Guest
I have the following:
Dictionary<object, string> d = new Dictionary<object, string>();
I can add entries to the dictionary, and I can loop through the entries I've
added to the Dictionary. This all works great.
My question is: I'd like to find a way to get just the first key, without
looping through the whole Dictionary. I tried the code below, but I get a
compile error trying to use an index value [0] on the KeyCollection:
Dictionary<object, string>.KeyCollection keyColl = d.Keys;
object firstStyle = keyColl[0];
Any suggestions?
Thanks,
Dictionary<object, string> d = new Dictionary<object, string>();
I can add entries to the dictionary, and I can loop through the entries I've
added to the Dictionary. This all works great.
My question is: I'd like to find a way to get just the first key, without
looping through the whole Dictionary. I tried the code below, but I get a
compile error trying to use an index value [0] on the KeyCollection:
Dictionary<object, string>.KeyCollection keyColl = d.Keys;
object firstStyle = keyColl[0];
Any suggestions?
Thanks,