Question : How can i fill 1D array from 2D array and how can i sort 1D array?


hanks everybody to help my idiot problem (look my before post:) ) . But i exactly need below. I should fill 1 dimentional array from legth of per cell Datatable. and sort 1D array linq and also without linq
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
 int[][] lengths;

            using (DataTable table = GetTable())
            {
                lengths = (from DataRow row in table.Rows
                           select
                           (from DataColumn col in table.Columns
                            select row[col].ToString().Length).ToArray()).ToArray();
            }

            int[] Sortedlist;
            foreach (int[] row in lengths)
            {
                Sortedlist = row; ---- I NEED HELP !!!!
            }

            foreach (int item in Sortedlist)
            {
                item.Sort(); ----- I NEED HELP!!!
            }

My Data: 



       static DataTable GetTable()
        {
            //
            // Here we create a DataTable with four columns.
            //
            DataTable table = new DataTable();
            table.Columns.Add("Dosage", typeof(int));
            table.Columns.Add("Drug", typeof(string));
            table.Columns.Add("Patient", typeof(string));
            table.Columns.Add("Date", typeof(DateTime));

            //
            // Here we add five DataRows.
            //
            table.Rows.Add(25, "Indocin", "David", DateTime.Now);
            table.Rows.Add(50, "Enebrel", "Sam", DateTime.Now);
            table.Rows.Add(10, "Hydralazine", "Christoff", DateTime.Now);
            table.Rows.Add(21, "Combivent", "Janet", DateTime.Now);
            table.Rows.Add(100, "Dilantin", "Melanie", DateTime.Now);

            return table;
        }

Answer : How can i fill 1D array from 2D array and how can i sort 1D array?

I mainly use RealVNC sometimes TinyVNC.

- Tom

Random Solutions  
 
programming4us programming4us