title: C# passing values from one method to another
body: <p>I am getting an error code in the result. code below. I am basically trying to get a data set from <code>SingleColumn</code> method and use it in <code>SMA</code> method. But I am getting results deos not exist in current context.</p>
  
  <pre><code>static public void SMA()
  {
      double[] closePrice = results.ToArray(); 
  </code></pre>
  
  <p>Below you can see the <code>SingleColumn</code> and part of <code>SMA</code> code. </p>
  
  <pre><code>#region Single Column
  //static public double results;
  static public void SingleColumn(IEnumerable&lt;string&gt; strs, int highNum)
  {
      #region spilt data to columns
      Console.WriteLine("Single Column Query:");
      var columnQuery = from line in strs 
                        let elements = line.Split(',')
                        select Convert.ToDouble(elements[highNum]); 
      var results = columnQuery.ToList();
      double[] closePrice = results.ToArray();
      #endregion
  
      #region max, min, avg
      double average = results.Average();
      double max = results.Max();
      double min = results.Min();
      Console.WriteLine("High: {0}: Low: {1}: Average: {2:0.00}", max, min, average);
      #endregion
  }
  
      #region Strategy Code SMA
  static public void SMA()
  {
      double[] closePrice = results.ToArray(); 
      int TOTAL_PERIODS = closePrice.Length;
      double[] output = new double[TOTAL_PERIODS];
      int begin;
      int length;
  
      for (int i = 0; i &lt; closePrice.Length-TOTAL_PERIODS; i++) //had to change from -1 to -TOTAL_PERIODS
      {
          closePrice[i] = (double)i;
      }
  
      TicTacTec.TA.Library.Core.RetCode retCode = Core.Sma(0, closePrice.Length-1, closePrice, PERIODS_AVERAGE, out begin, out length, output);
  </code></pre>