title: Razor: adding dynamic values together
body: <p>I have a set of values that are generated dynamically with a foreach loop, how can I add these into one value? </p>
  
  <p>For instance, say I have a site where each node has a number associated with it. How can I add all <em>these</em> numbers together? So far I've figured it'd be something similar to the following, where the value of 'node.aNumberValue' is added to the next one, and so on:</p>
  
  <pre><code>@foreach (var x in nodes){
  
      var total = node.aNumberValue + node.aNumberValue (etc...);
  
      &lt;p&gt;@total&lt;/p&gt;
  } 
  </code></pre>