示例#1
0
        public void AddnSetCurrent(string name)
        {
            if (string.IsNullOrWhiteSpace(name))
            {
                throw new ArgumentNullException("Имя не может быть пустым или null");
            }

            Phones = GetPhones();

            current_phone = Phones.SingleOrDefault(x => x.Name == name);
            if (current_phone == null)
            {
                current_phone = new Phone(name);
                Phones.Add(current_phone);
                newPhone = true;
                Save();
            }
        }