How to get a specific field of list of objects in an array of strings

nodrama

New Member
I have a list of persons like this :\[code\]foreach (GridViewRow r in gv_contactList.Rows) { Person p = new Person(); p.Id = int.Parse(gv_contactList.DataKeys[r.RowIndex].Value.ToString()); p.Name = r.Cells[1].Text.TrimEnd(); p.Mobile = r.Cells[2].Text.TrimEnd(); p.Email = r.Cells[3].Text.TrimEnd(); p.Pkind = 1;//ToDo plst.Add(p); }\[/code\]How to get an array of mobile numbers in \[code\]string[]\[/code\]in the same previous loop where the mobile number is not null or empty .instead of looping again through the list of persons to put the mobile numbers in the array.
 
Back
Top