how to add a variables which comes from dataset in for loop Collection array in c#?
- by leventkalay1986
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?