public KustoRestTable(KustoRestResponseTableV1 table = null)
 {
     if (table != null)
     {
         TableName = table.TableName;
         Columns   = table.Columns;
         Rows      = table.Rows;
     }
 }
        private KustoRestTableOfContentsV1 SetTableOfContents(KustoRestResponseV1 responseDataSet)
        {
            KustoRestTableOfContentsV1 content = new KustoRestTableOfContentsV1();

            if (responseDataSet == null || responseDataSet.Tables?.Length < 2)
            {
                Log.Debug($"no table of content table");
                return(content);
            }

            KustoRestResponseTableV1 tableOfContents = responseDataSet.Tables.Last();

            for (int c = 0; c < tableOfContents.Columns.Length; c++)
            {
                content.Columns.Add(
                    new KustoRestTableOfContentsColumnV1
                {
                    _index     = c,
                    ColumnName = tableOfContents.Columns[c].ColumnName,
                    ColumnType = tableOfContents.Columns[c].ColumnType,
                    DataType   = tableOfContents.Columns[c].DataType
                });
            }

            for (int r = 0; r < tableOfContents.Rows.Length; r++)
            {
                Hashtable record = new Hashtable();
                KustoRestTableOfContentsRowV1 row = new KustoRestTableOfContentsRowV1();

                object[] rowFields = tableOfContents.Rows[r];
                if (rowFields.Length != tableOfContents.Columns.Length)
                {
                    Log.Error($"mismatch in column count and row count {rowFields.Count()} {tableOfContents.Columns.Length}");
                    return(content);
                }

                row._index     = r;
                row.Id         = rowFields[content.Columns.First(x => x.ColumnName.Equals("Id"))._index].ToString();
                row.Kind       = rowFields[content.Columns.First(x => x.ColumnName.Equals("Kind"))._index].ToString();
                row.Name       = rowFields[content.Columns.First(x => x.ColumnName.Equals("Name"))._index].ToString();
                row.Ordinal    = Convert.ToInt64(rowFields[content.Columns.First(x => x.ColumnName.Equals("Ordinal"))._index]);
                row.PrettyName = rowFields[content.Columns.First(x => x.ColumnName.Equals("PrettyName"))._index].ToString();
                content.Rows.Add(row);
            }

            return(content);
        }