You are losing all your
Remove
changes. The
String.Remove Method (System) | Microsoft Docs[
^] returns the changed string, but you are throwing each one away.
[edit]
You need something like the following to capture the content of your DataTable:
foreach (DataRow dr in dt.Rows)
{
Dictionary<string, string> row = new Dictionary<string, string>();
string key = "";
if (dr.Field<string>("XMLNodePath") != "")
{
key = dr.Field<string>("XMLNodePath").Remove(0, 1);
key = key.Remove(key.Length - 1, 1);
}
string value = "";
if (dr.Field<string>("XMLElementValue") != "")
{
value = dr.Field<string>("XMLElementValue").Remove(0, 1);
value = value.Remove(value.Length - 1, 1);
}
rows.Add(key, value);
}
[/edit]