Firstly I created a collection which is ” Collection list;” and in a function RSS items includes Link Description Title which are string and Date which is Datetime variable, I tried to fill my collection list like this
Collection list;
for (int i = 0; i < dt.Rows.Count; i++)
{
row = dt.Rows[i];
list[i].Link = row[0].ToString();//
list[i].Description = row[1].ToString();
list[i].Title = row[2].ToString();
list[i].Date = DateTime.Parse(row[3].ToString());
}
There are errors which are cannot modify the return value of because it is not a variable which is under list[i].
How can i solve this problem? thanks
Try parsing the value into a DateTime:
I would be careful here though, since the value of row[3] may not be a valid date (is this some you can be sure of?)
In that case, you might want to have some defence:
Make sure
list.Dateis declared asDateTime?. Using this avoids having exceptions raised if row[3] is not a valid date if you calledDateTime.Parse().