C#C
C#3y ago
olleeee

✅ Lists is the same index all the time.

Hi, i have built different lists for different houses in Hogwarts and now Im trying to add members to the different houses through a sorting hat method. But every time the same house just get members added, why?
  public void SortingHat(Wizard wizard, List<House> hogwarts)
  {
      foreach (House house in hogwarts)
      {
          house.Members.Add(wizard);
          break;
      }

  }
Was this page helpful?