-2

i'm currently coding my own Sudoku in Windows Forms C# and I currently have Problems how to check if an integer is already in my list.

for (int i = 0; i < 9; i++)
        {
            List<int> list = new List<int>();
            for(int j = 0; j < 9; j++)
            {
                list.Add(sodukuPlayfield.grid[i, j]);
            }
        }

So I add all the number in a row to a list. But after that I wanna check if there is only one number from 1 - 9. How can I solve this?

Thank you.

Lesh
  • 3
  • 7

1 Answers1

0

I'm not quite sure where you want to put the list checking, but this is how you check if a list contains a specific number:

List.Contains(number you're searching for)

Hope it helps!

mindOfAi
  • 4,412
  • 2
  • 16
  • 27