I have a text file from which I want to store Keys
and Values
in a String
array.
In this case, Key
is something like &
On this way you can read each line of the text file. You fill the json with Key = until the ":" Value= From the ":"
Dictionary yourDictionary = new Dictionary();
string pathF = "C:\\fich.txt";
StreamReader file = new StreamReader(pathF, Encoding.Default);
string step = "";
List stream = new List();
while ((step = file.ReadLine()) != null)
{
if (!string.IsNullOrEmpty(step))
{
yourDictionary.Add(step.Substring(0, step.IndexOf(':')), step.Substring(step.IndexOf(':') + 1));
}
}