我想调用一个方法,其中两个参数是对象(一个检索人员,一个添加人员)。然后存储在 Person 对象数组中,然后我可以分别使用这两个对象。
在方法中:
我确实创建了对象 Person 并将数据存储在其中,从数据库中检索数据,其中 firstName 是“Mediterranean”。
并添加其他行(人员特征)并且也希望将其传回。但不返回对象并直接失败。
有人可以帮我吗?
我有这样的事情:
public Person [] retrievePerson(Person somePerson, Person addRowPerson)
{
.......
findedPerson = new Person(title, firstName, secondName, city, nationality, letter);
myTableCreatedPerson = new Person(title, firstName, secondName, city, nationality, letter);
return retrievePerson(findedPerson, myTableCreatedPerson);
}
//and calling function in different class like that
public void retrievePersonTest() //Create Person in DB directly then Retrieve Person and compare retrieve features with create features then directly delete him from DB
{
Person expected = null;
Person actual = null;
Person addRowPerson = null;
Person [] twoPersonArray;
DBConnect target = new DBConnect();
try //retrieve Person
{
twoPersonArray = target.retrievePerson(expected, addRowPerson); //do not return
twoPersonArray = (Func<Person, Person>)target.retrievePerson(expected, addRowPerson).CreateDelegate(typeof(Func<Person, Person>)); //do not return either
}
}