Answers for "write dictionary to file c#"

C#
1

how to save a c# dictionary

var dictionary = new JavaScriptSerializer()
    .Deserialize<Dictionary<string, string>>(File.ReadAllText("SomeFile.txt"));
Posted by: Guest on November-01-2020
1

how to save a c# dictionary

File.WriteAllText("SomeFile.Txt", new JavaScriptSerializer().Serialize(dictionary));
Posted by: Guest on November-01-2020
0

how to save a dictionary as a csv file in c#

String csv = String.Join(
    Environment.NewLine,
    data.Select(d => $"{d.Key};{d.Value};")
);
System.IO.File.WriteAllText(pathToCsv, csv);
Posted by: Guest on October-09-2020

C# Answers by Framework

Browse Popular Code Answers by Language