Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSHARP

Dictionary to string using C#

/// <summary>
/// Convert dictionary into string
/// </summary>
/// <param name="dictionary"></param>
/// <returns></returns>
public static string DictionaryToString(IDictionary<string, object> dictionary)
{
    if (dictionary == null) return string.Empty;
    var dictionaryString = dictionary.Aggregate(string.Empty,
        (current, keyValues) => current + (keyValues.Key + " : " + keyValues.Value + ", "));
    return dictionaryString.TrimEnd(',', ' ');
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #Dictionary #string
ADD COMMENT
Topic
Name
7+1 =