To achieve this, we can use the following namespace: "System.Collections.Generic". Here is a custom code snippet, where the single parameter is the Dictionary<string, string> parameter. You can change key and value type of a dictionary as per need.
- public string DictionaryToString(Dictionary < string, string > dictionary) {
- string dictionaryString = "{";
- foreach(KeyValuePair < string, string > keyValues in dictionary) {
- dictionaryString += keyValues.Key + " : " + keyValues.Value + ", ";
- }
- return dictionaryString.TrimEnd(',', ' ') + "}";
- }