Ejemplo n.º 1
0
        public int AddContact(string name, int phone)
        {
            if (name == "")
                return -1;

            if (phone <= 0)
                return -2;

            if (IndexOf (name) < 0) {
                if (currentContact < contacts.Length) {
                    var contact = new Contact ();
                    contact.name = name;
                    contact.phone = phone;
                    contacts [currentContact++] = contact;
                    return 0;
                } else
                    return -4;
            }

            return -3;
        }
Ejemplo n.º 2
0
 public static void Add(Contact contact)
 {
     contacts [current++] = contact;
 }