2

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

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

Only first 20 element are shown in the the output:

enter image description here

Can I somehow increase the size of output?

sup-team
  • 41
  • 1
  • 7
  • if you change 0 to 1 you will see it works fine, but with 0 it does not takes the last one, for me is also question why?! – Hadi R. Apr 22 '22 at 17:03
  • 1
    @HadiR. `var x = Enumerable.Range(1,21)` still results for me in only 20 elements being printed. Just the last printed one is changed from 19 to 20 (while the actual last one is 21). – sup-team Apr 22 '22 at 17:11

1 Answers1

5

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

Guru Stron
  • 102,774
  • 10
  • 95
  • 132