Hi All,

When i excute this code at return people i get PeopleViewer.Person instead of there names.Can anyone tell me what i am doing wrong.

Thanks for the help.

namespace PeopleViewer
{
    class PeopleRepository
    {
        public Person[] GetPeople()
        {
            var people = new Person[]
            {
                new Person() {FirstName="JOhn",LastName="Sheridan",StartDate = DateTime.Parse("2/7/12"),Rating=2},
                new Person() {FirstName="Matt",LastName="Hugher",StartDate = DateTime.Parse("2/3/77"),Rating=2},
            };
            return people;
        }

    }
}


namespace PeopleViewer
{
    public class Person
    {
        public string FirstName { get; set; }
        public string LastName { get; set; }
        public DateTime StartDate { get; set; }
        public int Rating {get;set;}
    }
}

Your GetPeople method returns an array of Person objects.
If you want to get, say a persons last name of the second person in the array, you use Person[1].LastName.

commented: This +8
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.