how to add a variables which comes from dataset in for loop Collection array in c#?
Posted
by
leventkalay1986
on Stack Overflow
See other posts from Stack Overflow
or by leventkalay1986
Published on 2012-03-20T17:14:21Z
Indexed on
2012/03/20
17:30 UTC
Read the original article
Hit count: 193
I have a collection of RSS items
protected Collection<Rss.Items> list = new Collection<Rss.Items>();
The class RSS.Items includes properties such as Link, Text, Description, etc.
But when I try to read the XML and set these properties:
for (int i = 0; i < dt.Rows.Count; i++)
{
row = dt.Rows[i];
list[i].Link.Equals(row[0].ToString());
list[i].Description.Equals( row[1].ToString());
list[i].Title.Equals( row[2].ToString());
list[i].Date.Equals( Convert.ToDateTime(row[3]));
}
I get a null reference exception on the line
list[i].Link.Equals(row[0].ToString());
What am I doing wrong?
© Stack Overflow or respective owner