In LINQPad, what's the equivalent of the C # .Dump () method in F #?
For example, what's the fastest way to dump the below C # in F # syntax?
var nums = new List<int> { 1, 2, 3, 4, 5 }; nums.Dump();
and
let nums = [1; 2; 3; 4; 5]
This works for me:
let nums = [1; 2; 3; 4; 5] nums.Dump()
You can also use Dump as a function:
Dump
let nums = [1; 2; 3; 4; 5] Dump nums nums |> Dump (* ... *)
Apart from the method already set .Dump() , you should know that it is also automatically called when you write the collection (and other types) in the console:
.Dump()
let nums = [1; 2; 3; 4; 5] Console.WriteLine(nums);
will also give you a dump.
This can be used in the middle of a workflow as well, as it returns its input.
let DumpHelper (caption:string) a = a.Dump(caption) a