rodchar,
Sorry, but I'm probably too busy to be answering this questions so quickly.
Here it is with supporting code...
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace FindTest
{
class Program
{
private static List<Person> listA = new List<Person>();
private static List<Person> listB = new List<Person>();
static void Main(string[] args)
{
listA.Add(new Person("Steve", "Jobs"));
listA.Add(new Person("Bill", "Gates"));
listA.Add(new Person("Dean", "Lee"));
listA.Add(new Person("Jeff", "Abernathy"));
listB.Add(new Person("Steve", "James"));
listB.Add(new Person("Bill", "Rose"));
listB.Add(new Person("Jeff", "Abernathy"));
foreach(Person person in listA)
{
Person tempPerson = listB.Find(x => x.FirstName == person.FirstName);
if(tempPerson
!= null)
{
Console.WriteLine(tempPerson.FirstName);
}
}
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace FindTest
{
class Person
{
private string lastName = string.Empty;
public string LastName
{
get
{
return lastName;
}
set
{
lastName = value;
}
}
private string firstName = string.Empty;
public string FirstName
{
get
{
return firstName;
}
set
{
firstName = value;
}
}
public Person(string firstName, string lastName)
{
this.firstName = firstName;
this.lastName = lastName;
}
}
}
rodchar said:
hey all,
i have 2 List<T> collections as noted in the subject (call it ListA and
ListB).
i need to iterate thru ListA and for each object in the collection i need
to
find one of the columns in ListA inside ListB, and if it's found return
that
row in ListB, modify it and move on.
is this possible? i noticed List<T>.Find but i'm fumbling with the syntax.
thanks,
rodchar