Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

dictionary to string C#

var asString = string.Join(Environment.NewLine, dictionary);
Comment

c# convert dictionary object to string

Dictionary<string, string> dString = dObject.ToDictionary(k => k.Key, k => k.Value ==  null ? "" : k.Value.ToString());
Comment

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(',', ' ');
}
Comment

PREVIOUS NEXT
Code Example
Csharp :: IHttpContextAccessor 
Csharp :: c# remove item from list 
Csharp :: convert html to pdf c# 
Csharp :: unity notification 
Csharp :: c# get custom attribute from property 
Csharp :: methods c# 
Csharp :: how to validate if date is a weekday or weekend c# 
Csharp :: c# convert list to array function 
Csharp :: how to concert a list into strinf splitted by coma c# 
Csharp :: c# switch statements 
Csharp :: make variables in c# 
Csharp :: Edit file C# 
Csharp :: LINQ query on a DataTable C# 
Csharp :: pyautogui not odwnloading 
Csharp :: quotes in string f# 
Csharp :: create new object from generic c# 
Csharp :: To CharArray 
Csharp :: asp.net core identity get all roles 
Csharp :: mongodb c# batch find 
Csharp :: .net core 6 autofac 
Csharp :: c# timer 30 seconds 
Csharp :: c# string right extension 
Csharp :: check file lock c# 
Csharp :: ihttpactionresult to object c# 
Csharp :: unity set parent canvas 
Csharp :: convert c# string to int 
Csharp :: how to convert timestamp to datetime c# 
Csharp :: c# for 
Csharp :: onmousedown not working unity 
Csharp :: c# windows forms cancel event 
ADD CONTENT
Topic
Content
Source link
Name
2+3 =