1
Answer

adding to a list from a List...

Sayed Faiz

Sayed Faiz

15y
3.6k
1
hi...i have got the following c# method
private void LoadJobReg(Job aJob, OleDbDataReader reader)
        {
            aJob.JobRegID = reader.GetInt32(0);
            aJob.JobID = reader.GetInt32(2);

            List<Job> JobsList = default(List<Job>);
            JobsList = new List<Job>();
            JobsList = this.GetJobByJobID(aJob.JobRegID);

            aJob.JobClient = JobsList.FindIndex(3).ToString;
            aJob.JobDate = JobsList.FindIndex(1).ToString;
            aJob.JobVenue = JobsList.FindIndex(2).ToString;
            aJob.JobNotes = JobsList.FindIndex(4).ToString;
        }

what I would like to do is in the last 4 lines of the method, add the individual items/elements of the JobsList list to aJob list. But I am not sure how to do it, as in the last 4 lines I am getting error on build, stating 'Error    3    The best overloaded method match for 'System.Collections.Generic.List<EntityLayer.Job>.FindIndex(System.Predicate<EntityLayer.Job>)' has some invalid arguments' and 'Error    4    Argument '1': cannot convert from 'int' to 'System.Predicate<EntityLayer.Job>'.

How can I do this?? Any help on the right way will be appreciated. Thanks.

Answers (1)