title: How to initialize and use an array
body: <p>I'm doing some c# homework and these are the instructions:</p>
  
  <blockquote>
    <p>Create a new project called FunWithArrays.</p>
    
    <p>Add a class called Game and make sure it is public. Game should have a
    public 2 dimensional byte array of size 5 x 5 called BingoCard.
    BingoCard should be initialized in the constructor for the Game class.
    There should also be a public string property called PlayerName in the
    Game class. The same constructor mentioned above should receive a
    string to initialize the player's name.</p>
    
    <p>Back in the main method create a single dimension Game array of size
    3. Add three new games using the names "Beth", "Chris", and "Don". Add a Random object to the main method.</p>
    
    <p>Pass the Game array and Random object to a static method called
    "InitilizeArray." Use a foreach loop to iterate through the games.
    Inside the foreachloop, use nested for loops to assign a random byte
    value to each of the 25 elements in the array. (hint: use something
    like (byte)rand.next() to have the Random object return a byte. Make
    sure that the random byte range is 1 to 75.</p>
    
    <p>Then, from the main method, pass the game array to a static method
    called "DisplayArray." Then use foreach and for loops as before to
    print out each player and that player's bingo card. The cards should
    be displayed in a table of 5 x 5 in the console.</p>
  </blockquote>
  
  <p>So far, I'm stuck in the 3rd paragraph. </p>
  
  <p>In the first paragraph I made a class which seems right:</p>
  
  <pre><code>public class Game
  {
      public Game() { }
  
      public Game (string pN)
      {
          PlayerName = pN;
          byte[,] BingoCard = new byte[5, 5];
      }
  
      public string PlayerName { get; set; }
  }
  </code></pre>
  
  <p>And for the second paragraph, in my main method:</p>
  
  <pre><code>static void Main(string[] args)
  {
      const int GameSize = 3;
  
      Random rand = new Random();
      Game[] gameArray = new Game[GameSize];
  
      Game game1 = new Game("Chris");
      Game game2 = new Game("Beth");
      Game game3 = new Game("Don");
  
      InitializeArray(gameArray[], rand);
  }
  </code></pre>
  
  <p>I'm not sure if I did the "create three new games" right, but I think it is.</p>
  
  <p>Now I'm having problems with the third paragraph, should I be passing each new game (game1, game2, game3) to the gameArray and then iterate through each game with a foreach loop such as:</p>
  
  <pre><code>foreach (var game in g)
  {
      for (int row = 0; row &lt; 5; row++)
      {
          for (int col = 0; col &lt; 5; col++)
          {
              game[row, col] = (byte)r.Next();
          }
      }
  }
  </code></pre>
  
  <p>How should I add three new games and initialize them?</p>