title: How to run single process for multiple values in c#?
body: <p>I need to run single process for list of symbols. So I have a list of symbols like AAPL, FB, QQQ, MSFT, IBM and also I have a function which contains logic of calculations for given symbol. So perform my this logic I am using Task.</p>
  
  <pre><code>List&lt;string&gt; symbolList = new List&lt;string&gt;() {"AAPL","QQQ","FB","MSFT","IBM"};
  Task[] taskArray = new Task[symbolList.Count];
  for(int i=0; i&lt;taskArray.Length; i++)
  {
     taskArray[i] = Task.Factory.StartNew(() =&gt;
         {
            criteriaEvalution.Evaluate(finalArray, false, new List&lt;parseObj&gt;(), ref builder, symbolList.IndexOf(i));
         });
  }
  Task.WaitAll(taskArray);
  </code></pre>
  
  <p>So when I am running this code then it's showing me error like </p>
  
  <blockquote>
    <p>Index was out of range. Must be non-negative and less than the size of the collection.</p>
  </blockquote>
  
  <p>Error is showing on line:</p>
  
  <pre><code>criteriaEvalution.Evaluate(finalArray, false, new List&lt;parseObj&gt;(), ref builder, symbolList.IndexOf(i));
  </code></pre>
  
  <p>where I am going to pass symbol name to the function.</p>
  
  <p>So please can I get a solution for this?
  I have checked on google for this it's saying for the index is out of range. I have checked by set debugger but I not understand how to check it for task regions.</p>