private int GetRecordsetFeatureCount(IRecordSet recordset)
{
if (recordset == null) { return 0; }
ICursor cursor = recordset.get_Cursor(true);
try
{
int i = 0;
while (cursor.NextRow() != null)
{
i++;
}
return i;
}
finally
{
this.ReleaseComObject(cursor);
}
}