internal int NewRecordFromArray(object[] value)
{
int colCount = _columnCollection.Count; // Perf: use the readonly columnCollection field directly
if (colCount < value.Length)
{
throw ExceptionBuilder.ValueArrayLength();
}
int record = _recordManager.NewRecordBase();
try
{
for (int i = 0; i < value.Length; i++)
{
if (null != value[i])
{
_columnCollection[i][record] = value[i];
}
else
{
_columnCollection[i].Init(record); // Increase AutoIncrementCurrent
}
}
for (int i = value.Length; i < colCount; i++)
{
_columnCollection[i].Init(record);
}
return record;
}
catch (Exception e) when (ADP.IsCatchableOrSecurityExceptionType(e))
{
FreeRecord(ref record);
throw;
}
}