コード例 #1
0
        public static Object[] Data(DataTable dtGrid)
        {
            var rows = new object[dtGrid.Rows.Count];

            for (int i = 0; i < dtGrid.Rows.Count; i++)
            {
                var fields   = new object[dtGrid.Columns.Count];
                int colIndex = 0;
                for (int j = 0; j < dtGrid.Columns.Count; j++)
                {
                    fields[colIndex] = DataConvert.ToString(dtGrid.Rows[i][j]);
                    colIndex        += 1;
                }

                rows[i] = new
                {
                    id   = i + 1,
                    cell = fields
                };
            }
            return(rows);
        }