ok so i am trying to do a little phone book. i have a class that has information on the individual, the main would read from a file of individuals and ask if the user wants to add or remove , and the last one is array of individuals..here is the code for info on the individuals but i want to be able to call a function from there to the array of individuals..how would i do that?

class PersonInfo
    {
        private string first_name = null;
        private string last_name = null;
        private string address = null;
        private string city = null;
        private string state = null;
        private int zipcode = 0;
        private string phone_num = null;

        public PersonInfo()
        {
           
        }

        public string getFirst_Name()
        {
            return first_name;
        }

        public void setFirst_Name(string first_name)
        {
            this.first_name = first_name;
        }

        public string getLast_Name()
        {
            return last_name;
        }

        public void setLast_Name(string last_name)
        {
            this.last_name = last_name;
        }

        public string getAddress()
        {
            return address;
        }

        public void setAddress(string address)
        {
            this.address = address;
        }

        public string getCity()
        {
            return city;
        }

        public void setCity(string city)
        {
            this.city = city;
        }

        public string getState()
        {
            return state;
        }

        public void setState(string state)
        {
            this.state = state;
        }
        public int getZipcode()
        {
            return zipcode;
        }

        public void setZipcode(int zipcode)
        {
            this.zipcode = zipcode;
        }
        public string getPhone_Num()
        {
            return phone_num;
        }

        public void setPhone_Num(string phone_num)
        {
            this.phone_num = phone_num;
        }
    }

this is the code i have for the array of individuals

class Person
    {
        ArrayList page = new ArrayList(); // creates a arraylist
        page.Add();

i want to be able to call a function from there to the array of individuals..how would i do that?

I'm not quite sure what you mean by that. Can you give a brief example? (just conceptually)

> i want to be able to call a function from there to the array of individuals..how would i do that?

Use generic.

using System;
using System.Collections.Generic;
class Program
    {
    static void Main(string[] args)
        {
            List<PersonInfo> a = new List<PersonInfo>();
            a.Add(new PersonInfo());
            a.Add(new PersonInfo());

            a[0].setFirst_Name("Mr.A");
            a[1].setCity("City1");
        }
     }

hey thanks ! that really helped

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.