System.Data.DataTable.NewEmptyRow C# (CSharp) Method

NewEmptyRow() private method

private NewEmptyRow ( ) : DataRow
return DataRow
        internal DataRow NewEmptyRow()
        {
            _rowBuilder._record = -1;
            DataRow dr = NewRowFromBuilder(_rowBuilder);
            if (_dataSet != null)
            {
                DataSet.OnDataRowCreated(dr);
            }
            return dr;
        }

Usage Example

        internal void ProcessDiffs(DataSet ds, XmlReader ssync)
        {
            int pos   = -1;
            int depth = ssync.Depth;

            ssync.Read();
            this.SkipWhitespaces(ssync);
            while (depth < ssync.Depth)
            {
                DataTable table     = null;
                string    attribute = null;
                int       num       = -1;
                int       num1      = ssync.Depth;
                attribute = ssync.GetAttribute("id", "urn:schemas-microsoft-com:xml-diffgram-v1");
                bool flag = ssync.GetAttribute("hasErrors", "urn:schemas-microsoft-com:xml-diffgram-v1") == "true";
                num = this.ReadOldRowData(ds, ref table, ref pos, ssync);
                if (num != -1)
                {
                    if (table == null)
                    {
                        throw ExceptionBuilder.DiffgramMissingSQL();
                    }
                    DataRow row = (DataRow)table.RowDiffId[attribute];
                    if (row != null)
                    {
                        row.oldRecord            = num;
                        table.recordManager[num] = row;
                    }
                    else
                    {
                        row = table.NewEmptyRow();
                        table.recordManager[num] = row;
                        row.oldRecord            = num;
                        row.newRecord            = num;
                        table.Rows.DiffInsertAt(row, pos);
                        row.Delete();
                        if (flag)
                        {
                            table.RowDiffId[attribute] = row;
                        }
                    }
                }
            }
        }
DataTable