System.Data.DataSet.TopLevelTables C# (CSharp) Méthode

TopLevelTables() private méthode

private TopLevelTables ( bool forSchema ) : System.Data.DataTable[]
forSchema bool
Résultat System.Data.DataTable[]
        internal DataTable[] TopLevelTables(bool forSchema)
        {
            // first let's figure out if we can represent the given dataSet as a tree using
            // the fact that all connected undirected graphs with n-1 edges are trees.
            List<DataTable> topTables = new List<DataTable>();

            if (forSchema)
            {
                // prepend the tables that are nested more than once
                for (int i = 0; i < Tables.Count; i++)
                {
                    DataTable table = Tables[i];
                    if (table.NestedParentsCount > 1 || table.SelfNested)
                    {
                        topTables.Add(table);
                    }
                }
            }
            for (int i = 0; i < Tables.Count; i++)
            {
                DataTable table = Tables[i];
                if (table.NestedParentsCount == 0 && !topTables.Contains(table))
                {
                    topTables.Add(table);
                }
            }

            return topTables.Count == 0 ?
                Array.Empty<DataTable>() :
                topTables.ToArray();
        }

Same methods

DataSet::TopLevelTables ( ) : System.Data.DataTable[]

Usage Example

 internal XmlDataTreeWriter(DataSet ds, DataTable dt)
 {
     this._dTables = new ArrayList();
     this._ds = ds;
     this._dt = dt;
     this._dTables.Add(dt);
     this.topLevelTables = ds.TopLevelTables();
 }
All Usage Examples Of System.Data.DataSet::TopLevelTables