title: The name 'myNumber' does not exist in the current context"
body: <p>I'm sure this has a very simple solution but I'm new to C# and I just can't seem to get rid of this error message.</p>
  
  <p>I'm trying to generate a random number between 1 and 100 inclusive in my code.</p>
  
  <pre><code>namespace FirstName_A1
  {
      class FromTwoDtoOneD
      {
          static void Main1()
          {
              int[,] twoDArray = new int[10,12];
              int[] oneDArray = new int[10*12];
  
              FillTwoDimArray(twoDArray);
              DisplayTwoDimArray(twoDArray);
              StoreValues(twoDArray, oneDArray);
              DisplayOneDimArray(oneDArray);
          }
  
          static void FillTwoDimArray(int[,] twoDArray) //method to fill twoD array with random numbers
          {
              Random myRandom = new Random(); //Random class is under System namespace
              myNumber = myRandom.Next(1, 101); //generates number between 1-100 inclusive
  
              for(int a=0;a&lt;10;a++)
              {
                  for(int b=0;b&lt;12;b++)
                  {
                      twoDArray[a, b] = myNumber;
                  }
              }
          }
  
          static void DisplayTwoDimArray(int[,] twoDArray)
          {
              Console.WriteLine("Two-Dimensional Array");
  
              for(int a=0;a&lt;10;a++)
              {
                  for(int b=0;b&lt;12;b++)
                  {
                      Console.Write(twoDArray[a, b] + " ");
                  }
  
                  Console.WriteLine();
              }
          }
  
          static void StoreValues(int[,] twoDArray, int[ ] oneDArray)
          {
              int c = 0;
  
              for(int a=0;a&lt;10;a++)
              {
                  for(int b=0;b&lt;12;b++)
                  {
                      oneDArray[c] = twoDArray[a, b];
  
                      c = c + 1;
                  }
              }
          }
  
          static void DisplayOneDimArray(int[] oneDArray)
          {
              Console.WriteLine("One Dimensional Array");
              for(int a=0;a&lt;10;a++)
              {
                  Console.WriteLine(oneDArray[a]);
              }
          }
      }
  }
  </code></pre>