title: c# System.ArgumentNullException: Value cannot be null. Parameter name: source
body: <p>The program that I have created needs to read information from a website and then store it. I am getting the error:</p>
  
  <blockquote>
    <p>System.ArgumentNullException: Value cannot be null.<br>
    Parameter name: source<br>
       at System.Linq.Enumerable.Select[TSource,TResult](IEnumerable<code>1 source,  Func</code>2 selector)</p>
  </blockquote>
  
  <p>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.</p>
  
  <pre><code>IEnumerable&lt;string&gt; webtemp = Enumerable.Empty&lt;string&gt;();
  if (datastring.Contains("today_nowcard-temp"))
  {
      webtemp = doc.DocumentNode.SelectNodes("//div[@class = 'today_nowcard-temp']/span").Select(d =&gt; 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);
      }
  }
  </code></pre>