How can i use listDictionary?
Posted
by Phsika
on Stack Overflow
See other posts from Stack Overflow
or by Phsika
Published on 2010-06-18T11:19:48Z
Indexed on
2010/06/18
11:23 UTC
Read the original article
Hit count: 209
i can fill my listdictinary but, if running error returns to me in " foreach (string ky in ld.Keys)"(invalid operation Exception was unhandled)
Error Detail : After creating a pointer to the list of sample collection has been changed. C#
ListDictionary ld = new ListDictionary();
foreach (DataColumn dc in dTable.Columns)
{
MessageBox.Show(dTable.Rows[0][dc].ToString());
ld.Add(dc.ColumnName, dTable.Rows[0][dc].ToString());
}
foreach (string ky in ld.Keys)
if (int.TryParse(ld[ky].ToString(), out QuantityInt))
ld[ky] = "integer";
else if(double.TryParse(ld[ky].ToString(), out QuantityDouble))
ld[ky]="double";
else
ld[ky]="nvarchar";
© Stack Overflow or respective owner