The code im trying wich is not working:
private void clearRichtextBox()
{
richTextBox2.Clear();
foreach (KeyValuePair<string, List<string>> kvp in LocalyKeyWords)
{
richTextBox2.AppendText("Url: " + kvp.Key + " --- " + "Localy KeyWord: " + kvp.Value);
}
}
LocalyKeyWords is a List > type of Dictionary.
Where string is the Key and List is the Value.
http://www.google.com is the Key for example and google is the value.
Now in this case LocalyKeywords contain 3 indexs each one have a Key and a Value.
I want after i cleared the richTextBox2 to add from the List all the Keys and Values to the richTextBox in a Format like this:
Url: http://www.google.com --- Localy Keyword: google
Url: http://www.cnet.com --- Localy Keyword: cnet
Url: http://www.microsoft.com --- Localy Keyword: microsoft
But im not getting it the way i did it.
How can i do it ? Something wrong with the foreach i prefer to make it with FOR and not foreach.
The List is built as Key,Value in the text file on my hard disk fhr format is like this:
http://www.cnet.com,cnet
Then in the constructor im reading it from the text file and put back the key and value into the List like this:
private void richTextBoxLoadKeys(Dictionary<string, List<string>> dictionary, string FileName)
{
string line = System.String.Empty;
using (StreamReader sr = new StreamReader(keywords))
{
while ((line = sr.ReadLine()) != null)
{
string[] tokens = line.Split(',');
dictionary.Add(tokens[0], tokens.Skip(1).ToList());
richTextBox2.AppendText("Url: " + tokens[0] + " --- " + "Localy KeyWord: " + tokens[1]);
}
sr.Close();
}
}
After loading the key and values in the constructor and using a breakpoint on the List i see:

You should iterate through the kvp.Value,it is also a list so you have to add each item from the list in the richtextbox.