Проверку допустимости присваиваемого значения можно провести с помощью следующего кода:
(Отметьте один правильный вариант ответа.)
Варианты ответа
private int m_AgeOfClient;public int AgeOfClient { get { if (AccessToPersonalInfoAllowed()) return m_AgeOfClient; } set { if (value > 0 && value <= 120) m_AgeOfClient = value; else MessageBox.Show("This client is not recommended for insurance"); }}(Верный ответ)
Hashtable ziphash = new Hashtable();...foreach (string zip in ziphash.Keys) { Console.WriteLine(zip + " " + ziphash[zip]);}
private int m_stateOfVeryCriticalResource;public int stateOfVeryCriticalResource { get { if (IsAllowedUser()) return m_stateOfVeryCriticalResource; } set { if (IsAdmin()) m_stateOfVeryCriticalResource = value; }}...stateOfVeryCriticalResource = vcrCompletelyScrewedUp;