示例#1
0
        private static int CompareByFirstName(Note x, Note y)
        {

            if (x == null)
            {
                if (y == null)
                {
                    return 0;
                }
                else
                {
                    return -1;
                }
            }
            else
            {
                if (y == null)
                {
                    return 1;
                }
                else
                {
                    int res = x.LastName.CompareTo(y.LastName);
                    if (res != 0)
                    {
                        return res;
                    }
                    else return 0;
                }
            }

        }
示例#2
0
 public string AddNote(Note n)
 {
     try
     {
         if (n == null) throw new NullReferenceException("Попытка добавить пустой объект");
         notes.Add(n);
         return String.Format("запись успешно добавлена");
     }
     catch (NullReferenceException e)
     {
         return e.Message;
     }
 }
示例#3
0
 private bool Search(Note n, params string[] args)
 {
     foreach (string s in args)
     {
         if (n.FirstName == s) return true;
         if (n.LastName == s) return true;
         if (n.TelNumber == s) return true;
         if (n.Email == s) return true;
         if (n.BirthDay == s) return true;
     }
     return false;
 }