I have an SPListItem
and I have an array of column names.
When I try to access the SPListItem
values using the code below:
for(int i=0;i<arrColName.length;i++)
{
string tempValue = item[arrColName[i]].ToString();
// Works fine in case the the specific column in the list item is not null
// Argument exception - Values does not fall witing expected range
// exception in case the value //is null
}
Sharepoint Lists aren't stored as a array with a static size.
You have to use the built in sharepoint iterator to go through each element
For example:
This will do work on each item in your SPlist
Edit: Wrong advice, I didn't see the code until after the edit.
Maybe try a cast?