Beispiel #1
0
        public void GetAllColumnsName()
        {
            List <string> numbercolumns = new List <string>();
            List <string> stringcolumns = new List <string>();
            List <string> allcolumns    = new List <string>();
            DataTable     table         = ModifiedData.ToTable();

            for (int col = 0; col < table.Columns.Count; col++)
            {
                string cell = table.Rows[0].ItemArray.ElementAt(col).ToString();
                float  x    = 0;
                allcolumns.Add(table.Columns[col].ToString());
                if (float.TryParse(cell, NumberStyles.Number, CultureInfo.InvariantCulture, out x))
                {
                    numbercolumns.Add(table.Columns[col].ToString());
                }
                else
                {
                    stringcolumns.Add(table.Columns[col].ToString());
                }
            }

            AllColumnList    = allcolumns;
            NumberColumnList = numbercolumns;
            StringColumnList = stringcolumns;
        }
Beispiel #2
0
        public List <string> GetAllClass(int nrcolumn)
        {
            DataTable      table      = ModifiedData.ToTable();
            IList <string> classnames = new List <string>();

            foreach (DataRow row in table.Rows)
            {
                classnames.Add(row.ItemArray.ElementAt(nrcolumn).ToString());
            }
            return(classnames.Distinct().ToList());
        }