title: Applying a method onto all instances of class inside a list
body: <p>I am picking up C# and as a beginners exercise I tried to code a simple Tekken Tournament roster. The problem is, that I cannot find a way how to apply a method of class <code>Fighter</code> onto the whole list of fighters, as there are no names of the variable, or at least I think that is the problem.</p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  
  namespace TekkenConsoleTournament
  {
      class MainClass
      {
          public static void Main (string[] args)
          {
              Console.WriteLine ("Enter nicknames of players, finished by 0: \n");
              int numFighter=0;
              String nickname;
              List &lt;Fighter&gt; allFighters = new List&lt;Fighter&gt;();
              while ((nickname = Console.ReadLine()) != "") {
                  allFighters.Add(new Fighter(nickname));
                  numFighter ++;
  
              }
              Console.WriteLine(allFighters.ForEach(Fighter.getName()));
  
              Console.WriteLine(foreach(Fighter in allFighters) {getName();}); 
  
              //for (int counter = 0; counter &lt;= fighter; counter++) {
              //  Fighter[counter.getName();
              //}
          }
      }
  }
  </code></pre>
  
  <p>And the Fighter.cs</p>
  
  <pre><code>using System;
  
  namespace TekkenConsoleTournament
  {
      public class Fighter
      {
          private int matches, won, lost, draw;
          String name;
          public Fighter (String name)
          {
              this.matches = this.won = this.lost = 0;
              this.name = name;
          }
  
          public void wonMatch()
          {
              matches++;won++;
  
          }
          public void lostMatch()
          {
              matches++;lost++;
  
          }
  
          public void drawMatch()
          {
              matches++;draw++;
  
          }
  
          public int[] getStats()
          {
              int[] stats = {this.matches,this.won,this.lost,this.draw};
              return stats;
          }
  
          public String getName()
          {
              return this.name;
          }
      }
  }
  </code></pre>
  
  <p>At first, I d like to print the names of all fighters, then maybe the stats and then as an exercise try making the code remember who fought who and put them in two dimensional matrix based on the result of the fight.</p>