System.Data.RecordManager.CopyRecord C# (CSharp) Метод

CopyRecord() приватный Метод

private CopyRecord ( DataTable src, int record, int copy ) : int
src DataTable
record int
copy int
Результат int
        internal int CopyRecord(DataTable src, int record, int copy)
        {
            Debug.Assert(src != null, "Can not Merge record without a table");

            if (record == -1)
            {
                return copy;
            }
            int newRecord = -1;
            try
            {
                newRecord = copy == -1 ?
                    _table.NewUninitializedRecord() :
                    copy;

                int count = _table.Columns.Count;
                for (int i = 0; i < count; ++i)
                {
                    DataColumn dstColumn = _table.Columns[i];
                    DataColumn srcColumn = src.Columns[dstColumn.ColumnName];
                    if (null != srcColumn)
                    {
                        object value = srcColumn[record];
                        ICloneable cloneableObject = value as ICloneable;
                        if (null != cloneableObject)
                        {
                            dstColumn[newRecord] = cloneableObject.Clone();
                        }
                        else
                        {
                            dstColumn[newRecord] = value;
                        }
                    }
                    else if (-1 == copy)
                    {
                        dstColumn.Init(newRecord);
                    }
                }
            }
            catch (Exception e) when (Common.ADP.IsCatchableOrSecurityExceptionType(e))
            {
                if (-1 == copy)
                {
                    FreeRecord(ref newRecord);
                }
                throw;
            }
            return newRecord;
        }