title: Manipulating Values in Dictionary
body: <p>So I have a dictionary whose index is an int, and whose value is a class that contains a list of doubles, the class is built like this:</p>
  
  <pre><code>public class MyClass
  {
      public List&lt;double&gt; MyList = new List&lt;double&gt;();
  }
  </code></pre>
  
  <p>and the dictionary is built like this:</p>
  
  <pre><code>public static Dictionary&lt;int, MyClass&gt; MyDictionary = new Dictionary&lt;int, MyClass&gt;();
  </code></pre>
  
  <p>I populate the dictionary by reading a file in line by line, and adding the pieces of the file into a splitstring, of which there is a known number of parts (100), then adding the pieces of the string into the list, and finally into the dictionary. Here's what that looks like:</p>
  
  <pre><code>public void DictionaryFiller()
  {
      string LineFromFile;
      string[] splitstring;
      int LineNumber = 0;
      StreamReader sr = sr.ReadLine();
  
      while (!sr.EndOfStream)
      {
          LineFromFile = sr.ReadLine();
          splitstring = LineFromFile.Split(',');
  
          MyClass newClass = new MyClass();
  
          for (int i = 1; i &lt; 100; i++)
          {
              newClass.MyList.Add(Convert.ToDouble(splitstring[i]));
          }
  
          MyDictionary.Add(LineNumber, MyClass);
  
          LineNumber++;
      }
  }
  </code></pre>
  
  <p>My question is this: is I were to then read another file and begin the DictionaryFiller method again, could I add terms to each item in the list for each value in the dictionary. What I mean by that is, say the file's 1st line started with 10,23,15,... Now, when I read in a second file, lets say its first line begins with 10,13,18,... what I'm looking to have happen is for the dictionary to have the first 3 doubles in its value-list (indexed at 0) to then become 20,36,33,...</p>
  
  <p>Id like to be able to add terms for any number of files read in, and ultimately then take their average by going through the dictionary again (in a separate method) and dividing each term in the value-list by the number of files read in. Is this possible to do? Thanks for any advice you have, I'm a novice programmer and any help you have is appreciated.</p>