Who is the largest among all the lines?

I am inserting a special (summary) row in the DataTable , and I want it to be displayed last in the sorted DataView . I know that a DataView sorted (incremented) by a specific column of the row, and for display purposes it does not matter what value appears in this column of the resulting row.

What line can I put in this field to make sure the summary line is sorted to the very end? For columns of almost any other data type, I could use T.MaxValue , but unfortunately there is no System.String.MaxValue constant.

I have already tried

 footerRow[colGrouping] = "\uFFFF"; 

but it is sorted at the top! ( DataView lexicographic sorting, not based on the numerical value of the code point)

+5
source share
1 answer

If I were in the wing, not understanding the lexicographical order, I would say \ uFF70

 var table = new DataTable("table"); table.Columns.Add("column"); for (int i = 0; i < 65536; i++) { var row = table.NewRow(); row["column"] = (char)i; table.Rows.Add(row); } var view = new DataView(table); view.Sort = "column"; var last = ((string)view[65535]["column"])[0]; //last is 0xff70 'ο½°' 
+1
source

Source: https://habr.com/ru/post/1259240/


All Articles