public override object Aggregate(int[] records, AggregateType kind)
{
try
{
switch (kind)
{
case AggregateType.First:
if (records.Length > 0)
{
return _values[records[0]];
}
return null;
case AggregateType.Count:
int count = 0;
for (int i = 0; i < records.Length; i++)
{
if (!IsNull(records[i]))
count++;
}
return count;
}
}
catch (OverflowException)
{
throw ExprException.Overflow(typeof(SqlBinary));
}
throw ExceptionBuilder.AggregateException(kind, _dataType);
}