Conversation
| @@ -0,0 +1,93 @@ | |||
| using System; | |||
|
|
|||
| namespace NewFindACouple | |||
There was a problem hiding this comment.
Надо использовать file-scoped namespaces, namespace NewFindACouple; и дальше без фигурной скобки и отступа
| { | ||
| if (button.Tag == null || previousButton.Tag == null) | ||
| { | ||
| throw new NullReferenceException(); |
There was a problem hiding this comment.
NullReferenceException в принципе кидать нельзя, оно системное :)
| public void AddGrid(int size) | ||
| { | ||
|
|
||
| int[] arrayForNumbers = new int[size * size]; |
There was a problem hiding this comment.
| int[] arrayForNumbers = new int[size * size]; | |
| var arrayForNumbers = new int[size * size]; |
|
|
||
| for (int i = 0; i < size; i++) | ||
| { | ||
| var random = new Random(); |
There was a problem hiding this comment.
Никогда не создавайте Random в цикле, а то он почти всегда одни значения возвращать будет. Ну и сборщик мусора спасибо не скажет
| { | ||
| for (int j = 0; j < size; ++j) | ||
| { | ||
| Button button = new Button(); |
There was a problem hiding this comment.
| Button button = new Button(); | |
| Button button = new(); |
| @@ -0,0 +1,2 @@ | |||
| namespace NewFindACouple; | |||
| internal class IncorectNumberException : Exception{} No newline at end of file | |||
There was a problem hiding this comment.
| internal class IncorectNumberException : Exception{} | |
| internal class IncorrectNumberException : Exception{} |
| int result = 0; | ||
| bool check = int.TryParse(args[0], out result); |
There was a problem hiding this comment.
| int result = 0; | |
| bool check = int.TryParse(args[0], out result); | |
| bool check = int.TryParse(args[0], out int result); |
| this.Controls.Add(button); | ||
| top += button.Height + 2; | ||
| button.Name = "btn" + i + '.' + j; | ||
| button.Tag = arrayForNumbers[k].ToString(); |
There was a problem hiding this comment.
Непонятно, как обеспечивается "парность" кнопок, в массиве ведь просто числа от 0 до size * size
| button.Tag = "-"; | ||
| } | ||
| } | ||
| previousButtonTag = string.Copy(button.Tag.ToString()); |
There was a problem hiding this comment.
string.Copy не нужен, просто присвоения достаточно
No description provided.