📅  最后修改于: 2022-03-11 14:48:40.728000             🧑  作者: Mango
public IEnumerable GetData(IDataReader reader, Func BuildObject)
{
try
{
while (reader.Read())
{
yield return BuildObject(reader);
}
}
finally
{
reader.Dispose();
}
}
//call it like this:
var result = GetData(YourLibraryFunction(), Employee.Create);