I am trying to implement a simple construct where I first clear the NameValueCollection and the write new values to it. However at the moment I can't because it is read only. Is there a way to make it not read only or a walk around? My Code:
NameValueCollection DataDictionary = ConfigurationManager.GetSection("dataDictionary") as NameValueCollection;
DataDictionary.Clear();
for (int i = 0; i < tableLayoutPanel2.RowCount; i++)
{
var T = tableLayoutPanel2.GetControlFromPosition(1, i);
var T2 = tableLayoutPanel2.GetControlFromPosition(3, i);
string key = T.Text;
string value = T2.Text;
DataDictionary.Add(key, value);
}
Copy it in a new
NameValueCollection
: