The program that I have created needs to read information from a website and then store it. I am getting the error:
System.ArgumentNullException: Value cannot be null.
Parameter name: source
at System.Linq.Enumerable.Select[TSource,TResult](IEnumerable1 source, Func
2 selector)
However it does not always run in error. As in sometimes it works and sometimes it doesn't work. How can this be? Here is the code that is giving me the error line 4.
IEnumerable<string> webtemp = Enumerable.Empty<string>();
if (datastring.Contains("today_nowcard-temp"))
{
webtemp = doc.DocumentNode.SelectNodes("//div[@class = 'today_nowcard-temp']/span").Select(d => d.InnerText.Trim());
foreach (var this_header in webtemp)
{
string[] temporary = this_header.Trim().Replace("Â", "-").Replace(" ", "-").Split('-');
int f = (Convert.ToInt32(temporary[0]));
_actualData[0].temp = GetCelsius(f);
//Console.WriteLine(_actualData[0].temp);
}
}