There is a form with text nomer1 , nomer2 , etc. When a form is loaded, a file is read in which the box is registered or not.
using (StreamReader reader = new StreamReader(@"C:\test\viseble.txt")) { if (reader.ReadLine() == "1 true") { nomer1.Visibility = Visibility.Visible; } else { nomer1.Visibility = Visibility.Hidden; } if (reader.ReadLine() == "2 true") { nomer2.Visibility = Visibility.Visible; } else { nomer2.Visibility = Visibility.Hidden; } } There are many textboxes and a very large piece of duplicate code is obtained. Please tell me how it can be simplified?

(expr)?Visible:Hidden2. You can use((WebControl)FindControl("nomer" + i)).Visibility- nick_n_a