public void AddLayer(int size) { var newLayer = new Layer { Type = LayerType.HiddenLayer, Size = size, Neurons = new List <Neuron>(), Index = AllLayers.Where(x => x.Type == LayerType.HiddenLayer).ToList().Count + 1, Name = "Hidden Layer " + (AllLayers.Where(x => x.Type == LayerType.HiddenLayer).ToList().Count + 1), Value = AllLayers.Where(x => x.Type == LayerType.HiddenLayer).ToList().Count + 1 }; newLayer.FillLayer(); AllLayers.Add(newLayer); InitLayers(); }