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

DeserializeDataTable() private method

private DeserializeDataTable ( SerializationInfo info, StreamingContext context, bool isSingleTable, SerializationFormat remotingFormat ) : void
info SerializationInfo
context StreamingContext
isSingleTable bool
remotingFormat SerializationFormat
return void
        internal void DeserializeDataTable(SerializationInfo info, StreamingContext context, bool isSingleTable, SerializationFormat remotingFormat)
        {
            if (remotingFormat != SerializationFormat.Xml)
            {
                //Binary
                DeserializeTableSchema(info, context, isSingleTable);
                if (isSingleTable)
                {
                    DeserializeTableData(info, context, 0);
                    ResetIndexes();
                }
            }
            else
            {
                //XML/V1.0/V1.1
                string strSchema = (string)info.GetValue(KEY_XMLSCHEMA, typeof(string));
                string strData = (string)info.GetValue(KEY_XMLDIFFGRAM, typeof(string));

                if (strSchema != null)
                {
                    DataSet ds = new DataSet();
                    ds.ReadXmlSchema(new XmlTextReader(new StringReader(strSchema)));

                    Debug.Assert(ds.Tables.Count == 1, "There should be exactly 1 table here");
                    DataTable table = ds.Tables[0];
                    table.CloneTo(this, null, false);
                    //this is to avoid the cascading rules in the namespace
                    Namespace = table.Namespace;

                    if (strData != null)
                    {
                        ds.Tables.Remove(ds.Tables[0]);
                        ds.Tables.Add(this);
                        ds.ReadXml(new XmlTextReader(new StringReader(strData)), XmlReadMode.DiffGram);
                        ds.Tables.Remove(this);
                    }
                }
            }
        }
DataTable