"Ссылка на объект не указывает на экземпляр объекта."
class Cell:Button
{
public bool Presence { get; set; }
}
public MainWindow()
{
InitializeComponent();
Cell[,] cells = new Cell[10, 10];
foreach (var item in cells)
{
item.Presence = true;//тут ловлю Exeption "Ссылка на объект не указывает на экземпляр объекта."
//item.Height = 5;
//item.Width = 5;
//item.Background = Brushes.Gray;
//item.BorderBrush = Brushes.Black;
}
}
В чем ошибка?