Settings and activity
6 results found
-
50 votes
Are you aware that you can call .Dump() on an expression? The output is not exactly the same as the Expression Tree Visualizer, but it conveys much of the same information. Is there anything missing from what you see that you’d like added? Or anything that you’d like changed?
An error occurred while saving the comment -
1,276 votesNelson Ferrari supported this idea ·
-
12 votes
An error occurred while saving the comment Nelson Ferrari commentedI would use it to process log files and similar. Copy multiple lines and paste on LINQPad's input.
Nelson Ferrari supported this idea · -
18 votesNelson Ferrari supported this idea ·
-
8 votes
An error occurred while saving the comment Nelson Ferrari commentedI saw a HexDump extension somewhere (probably in the forums). Since I cannot remember the place, here is his suggestion (just copy it to "MyExtensions"):
[code]
void Main()
{
// Write code to test your extensions here. Press F5 to compile and run.
byte[] text = Encoding.UTF8.GetBytes("The quick brown fox jumps over the lazy dog");
var textList = new List<byte>(text);
//HexDump(text);
text.HexDump();
textList.HexDump();
}public static class MyExtensions
{
// Write custom extension methods here. They will be available to all queries.
public static object HexDump(this byte[] data)
{
return data
.Select((b, i) => new { Byte = b, Index = i })
.GroupBy(o => o.Index / 16)
.Select(g =>
g
.Aggregate(
new { Hex = new StringBuilder(), Chars = new StringBuilder() },
(a, o) => {a.Hex.AppendFormat("{0:X2} ", o.Byte); a.Chars.Append(Convert.ToChar(o.Byte)); return a;},
a => new { Hex = a.Hex.ToString(), Chars = a.Chars.ToString() }
)
)
.ToList()
.Dump();
}
public static object HexDump(this List<byte> data)
{
return data.ToArray().HexDump();
}
}
[/code] -
7 votesNelson Ferrari shared this idea ·
Isn't this what the "Tree" result option (Results Lambda SQL IL+Native Tree) does?