private void Fitler() { Filter_Adventure.SetName(Template_Adventure_Name.Text); IEnumerable <Adventure> array = Filter.Adventure(GeneralControl.Adventures, Filter_Adventure); foreach (Custom_Card_Adventure item in AdventurePanel.Children) { if (array != null && array.Where <Adventure>(x => item.Adventure.Equals(x)).Count() != 0) { item.Visibility = Visibility.Visible; } else { item.Visibility = Visibility.Collapsed; } } }