How to get all the keys (only keys) from dictionary object without going through for each loop

I’m not certain from your wording whether you want the keys or the values. Either way, it’s pretty straightforward. Use either the Keys or Values property of the dictionary and the ToArray extension method.

var arrayOfAllKeys = yourDictionary.Keys.ToArray();

var arrayOfAllValues = yourDictionary.Values.ToArray();

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)