Dump to DataGrids - Hyperlinqs that resolve to null
When dumping results to Data Grids, rather than Rich Text, it renders "complex"* objects as Hyperlinqs (because Data Grids only show nesting one level deep), which resolve themselves into a new output panel when you click on them. This is all well and good.
*Not sure on the technical term, sorry
Interestingly, I have noticed that:
To explain what I mean in examples, the following (C# statements) code shows this behavior:
Thanks for your time reading this
*Not sure on the technical term, sorry
Interestingly, I have noticed that:
- If all the values in the column are of the same type, then each cell contains a Hyperlinq, rendered with the name of the column. However, quite often the value in the cell is null, and I find it annoying/tedious to click on the Hyperlinq just to see that this is the case.
- Otherwise (when not all of the values in the column are of the same type), null values appear as null, and non-null values are displayed as Hyperlinqs containing the name of the type of the value in the cell.
To explain what I mean in examples, the following (C# statements) code shows this behavior:
Mostly I use output in rich text to get around this "problem", but there are times when I find data grids preferable. I wonder if anyone else feels the same?
var rand = new Random();
// 1: shows a column full of "b"s that may or may not resolve to null when you click on each one - because they are all the same non-value type. Ideally, it would either show null or a Hyperlinq.
Enumerable.Range(1, 15).Select (e => new { a = "a", b = rand.Next(0, 2) == 0 ? null : new { d = 5 - e }, c = e }).Dump();
// shows null where applicable, because value type
//Enumerable.Range(1, 15).Select (e => new { a = "a", b = rand.Next(0, 2) == 0 ? null : (int?)e, c = e }).Dump();
// 2: the following is the behavior I would like to see when all values in the column are the same type:
Func ex = i => i == 0 ? null : i == 1 ? (object)new { d = "example" } : (object)EventArgs.Empty;
Enumerable.Range(1, 15).Select (e => new { a = "a", b = ex(rand.Next(0, 3)), c = e }).Dump();
Thanks for your time reading this
Comments
A workaround is that you can right-click the column and click 'Expand hyperlinks in this column' to explicitly expand hyperlinks.