Home > Software design >  .NET Interactive - how to change collection output size
.NET Interactive - how to change collection output size

Time:04-23

I'm using .NET Interactive notebook inside VS Code and want to change the size of the printed out collection:

var x = Enumerable.Range(0,21);
x.Display();

Only first 20 element are show in the the output:

enter image description here

Can I somehow increase the size of output?

CodePudding user response:

You can use Formatter from Microsoft.DotNet.Interactive.Formatting namespace to change the size of the output:

using Microsoft.DotNet.Interactive.Formatting; 
Formatter.ListExpansionLimit = 25;

Docs:

  • Formatter.ListExpansionLimit = 20

    Gets or sets the limit to the number of items that will be written out in detail from an IEnumerable sequence.

  • Formatter<T>.ListExpansionLimit = (not set)

    An optional type-specific list expansion limit

  • Related