3 overrides of FormatObject
Microsoft.CodeAnalysis.CSharp.Scripting (1)
Hosting\ObjectFormatter\CSharpObjectFormatter.cs (1)
22public override string FormatObject(object obj, PrintOptions options) => s_impl.FormatObject(obj, options);
Microsoft.CodeAnalysis.Scripting (1)
Hosting\ObjectFormatter\CommonObjectFormatter.cs (1)
22public override string FormatObject(object obj, PrintOptions options)
Microsoft.CodeAnalysis.VisualBasic.Scripting (1)
Hosting\ObjectFormatter\VisualBasicObjectFormatter.vb (1)
19Public Overrides Function FormatObject(obj As Object, options As PrintOptions) As String
113 references to FormatObject
Microsoft.CodeAnalysis.CSharp.Scripting (1)
Hosting\ObjectFormatter\CSharpObjectFormatter.cs (1)
22public override string FormatObject(object obj, PrintOptions options) => s_impl.FormatObject(obj, options);
Microsoft.CodeAnalysis.CSharp.Scripting.Desktop.UnitTests (7)
ObjectFormatterTests.cs (7)
27var str = s_formatter.FormatObject(obj, SingleLineOptions); 40var str = s_formatter.FormatObject(obj, SeparateLinesOptions); 55var str = s_formatter.FormatObject(obj, SingleLineOptions); 67var str = s_formatter.FormatObject(obj, SingleLineOptions); 79var str = s_formatter.FormatObject(obj, SingleLineOptions); 85str = s_formatter.FormatObject(obj, SingleLineOptions); 119var str = s_formatter.FormatObject(obj, SeparateLinesOptions);
Microsoft.CodeAnalysis.CSharp.Scripting.UnitTests (72)
ObjectFormatterTests.cs (47)
37str = s_formatter.FormatObject(nested, SingleLineOptions); 40str = s_formatter.FormatObject(nested, HiddenOptions); 43str = s_formatter.FormatObject(A<int>.X, HiddenOptions); 47str = s_formatter.FormatObject(obj, HiddenOptions); 100var str = s_formatter.FormatObject(o, HiddenOptions); 292str = s_formatter.FormatObject(obj, SeparateLinesOptions); 300str = s_formatter.FormatObject(obj, SeparateLinesOptions); 322str = s_formatter.FormatObject(obj, SeparateLinesOptions); 332str = s_formatter.FormatObject(obj, SingleLineOptions); 359var actual = s_formatter.FormatObject(obj, printOptions); 370var str = new TestCSharpObjectFormatter(maximumLineLength: 20).FormatObject(obj, SingleLineOptions); 373str = new TestCSharpObjectFormatter(maximumLineLength: 20).FormatObject(obj, SeparateLinesOptions); 381var str = s_formatter.FormatObject(obj, SeparateLinesOptions); 413str = s_formatter.FormatObject(a, SingleLineOptions); 416str = s_formatter.FormatObject(a, SeparateLinesOptions); 426str = s_formatter.FormatObject(obj, SingleLineOptions); 430str = s_formatter.FormatObject(x, SingleLineOptions); 434str = s_formatter.FormatObject(y, SingleLineOptions); 438str = s_formatter.FormatObject(z, SingleLineOptions); 449str = s_formatter.FormatObject(obj, SingleLineOptions); 483str = s_formatter.FormatObject(obj, SingleLineOptions); 510str = s_formatter.FormatObject(obj, SingleLineOptions); 524str = s_formatter.FormatObject(obj, SingleLineOptions); 527str = s_formatter.FormatObject(obj, SeparateLinesOptions); 543str = s_formatter.FormatObject(obj, SingleLineOptions); 552var str = s_formatter.FormatObject(obj, SingleLineOptions); 564var str = s_formatter.FormatObject(obj, SingleLineOptions); 576var str = s_formatter.FormatObject(obj, SingleLineOptions); 588var str = s_formatter.FormatObject(obj, SeparateLinesOptions); 594str = s_formatter.FormatObject(obj, SingleLineOptions); 604var str = s_formatter.FormatObject(obj, SingleLineOptions); 613var str = s_formatter.FormatObject(obj, SingleLineOptions); 625var str = s_formatter.FormatObject(obj, SingleLineOptions); 637var str = s_formatter.FormatObject(obj, SingleLineOptions); 643str = s_formatter.FormatObject(obj2, SingleLineOptions); 656FormatObject(obj, new PrintOptions { NumberRadix = ObjectFormatterHelpers.NumberRadixHexadecimal }); 670var str = s_formatter.FormatObject(obj, SingleLineOptions); 681var str = s_formatter.FormatObject(obj, SingleLineOptions); 691var str = s_formatter.FormatObject(obj, SingleLineOptions); 704var str = s_formatter.FormatObject(obj, SingleLineOptions); 716var str = s_formatter.FormatObject(obj, SingleLineOptions); 727var str = s_formatter.FormatObject(obj, SingleLineOptions); 747var str = s_formatter.FormatObject(obj, SingleLineOptions); 758var str = s_formatter.FormatObject(obj, SingleLineOptions); 761str = s_formatter.FormatObject(obj, SeparateLinesOptions); 771str = s_formatter.FormatObject(obj, SingleLineOptions); 774str = s_formatter.FormatObject(obj, SeparateLinesOptions);
PrintOptionsTests.cs (25)
21Assert.Throws<ArgumentNullException>(() => s_formatter.FormatObject("hello", options: null)); 50Assert.Equal("10", formatter.FormatObject(10, options)); 51Assert.Equal("int[10] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }", formatter.FormatObject(new int[10], options)); 52Assert.Equal(@"16 '\u0010'", formatter.FormatObject('\u0010', options)); 55Assert.Equal("0x0000000a", formatter.FormatObject(10, options)); 56Assert.Equal("int[0x0000000a] { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 }", formatter.FormatObject(new int[10], options)); 57Assert.Equal(@"0x0010 '\u0010'", formatter.FormatObject('\u0010', options)); 66Assert.Equal("PrintOptions", s_formatter.FormatObject(options, options)); 69Assert.Equal("PrintOptions { Ellipsis=\"...\", EscapeNonPrintableCharacters=true, MaximumOutputLength=1024, MemberDisplayFormat=SingleLine, NumberRadix=10 }", s_formatter.FormatObject(options, options)); 82", s_formatter.FormatObject(options, options)); 91Assert.Equal(@"""\t""", s_formatter.FormatObject("\t", options)); 92Assert.Equal(@"'\t'", s_formatter.FormatObject('\t', options)); 95Assert.Equal("\"\t\"", s_formatter.FormatObject("\t", options)); 96Assert.Equal("'\t'", s_formatter.FormatObject('\t', options)); 105Assert.Equal("1...", s_formatter.FormatObject(123456, options)); 108Assert.Equal("12...", s_formatter.FormatObject(123456, options)); 111Assert.Equal("123...", s_formatter.FormatObject(123456, options)); 114Assert.Equal("1234...", s_formatter.FormatObject(123456, options)); 117Assert.Equal("12345...", s_formatter.FormatObject(123456, options)); 120Assert.Equal("123456", s_formatter.FormatObject(123456, options)); 123Assert.Equal("123456", s_formatter.FormatObject(123456, options)); 133Assert.Equal("1.", s_formatter.FormatObject(123456, options)); 136Assert.Equal("1..", s_formatter.FormatObject(123456, options)); 139Assert.Equal("1", s_formatter.FormatObject(123456, options)); 142Assert.Equal("1", s_formatter.FormatObject(123456, options));
Microsoft.CodeAnalysis.Scripting (3)
Hosting\CommandLine\CommandLineScriptGlobals.cs (1)
39_outputWriter.WriteLine(_objectFormatter.FormatObject(value, PrintOptions));
Hosting\InteractiveScriptGlobals.cs (1)
39_outputWriter.WriteLine(_objectFormatter.FormatObject(value, PrintOptions));
Hosting\ObjectFormatter\ObjectFormatter.cs (1)
16public string FormatObject(object obj) => FormatObject(obj, new PrintOptions());
Microsoft.CodeAnalysis.VisualBasic.Scripting (1)
Hosting\ObjectFormatter\VisualBasicObjectFormatter.vb (1)
20Return s_impl.FormatObject(obj, options)
Microsoft.CodeAnalysis.VisualBasic.Scripting.UnitTests (29)
ObjectFormatterTests.vb (10)
41str = s_formatter.FormatObject(nested, SingleLineOptions) 44str = s_formatter.FormatObject(nested, HiddenOptions) 51str = s_formatter.FormatObject(obj, HiddenOptions) 55str = New TestVisualBasicObjectFormatter(maximumLineLength:=51).FormatObject(sort, SingleLineOptions) 59str = New TestVisualBasicObjectFormatter(maximumLineLength:=5).FormatObject(sort, SingleLineOptions) 63str = New TestVisualBasicObjectFormatter(maximumLineLength:=4).FormatObject(sort, SingleLineOptions) 66str = New TestVisualBasicObjectFormatter(maximumLineLength:=3).FormatObject(sort, SingleLineOptions) 69str = New TestVisualBasicObjectFormatter(maximumLineLength:=2).FormatObject(sort, SingleLineOptions) 72str = New TestVisualBasicObjectFormatter(maximumLineLength:=1).FormatObject(sort, SingleLineOptions) 75str = New TestVisualBasicObjectFormatter(maximumLineLength:=80).FormatObject(sort, SingleLineOptions)
PrintOptionsTests.vb (19)
18Assert.Throws(Of ArgumentNullException)(Sub() s_formatter.FormatObject("hello", options:=Nothing)) 59Assert.Equal("10", s_formatter.FormatObject(10, options)) 60Assert.Equal("Integer(10) { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }", s_formatter.FormatObject(array, options)) 64Assert.Equal("&H0000000A", s_formatter.FormatObject(10, options)) 65Assert.Equal("Integer(&H0000000A) { &H00000000, &H00000000, &H00000000, &H00000000, &H00000000, &H00000000, &H00000000, &H00000000, &H00000000, &H00000000 }", s_formatter.FormatObject(array, options)) 74Assert.Equal("PrintOptions", s_formatter.FormatObject(options, options)) 77Assert.Equal("PrintOptions { Ellipsis=""..."", EscapeNonPrintableCharacters=True, MaximumOutputLength=1024, MemberDisplayFormat=SingleLine, NumberRadix=10 }", s_formatter.FormatObject(options, options)) 90", s_formatter.FormatObject(options, options)) 111Assert.Equal("1...", s_formatter.FormatObject(123456, options)) 114Assert.Equal("12...", s_formatter.FormatObject(123456, options)) 117Assert.Equal("123...", s_formatter.FormatObject(123456, options)) 120Assert.Equal("1234...", s_formatter.FormatObject(123456, options)) 123Assert.Equal("12345...", s_formatter.FormatObject(123456, options)) 126Assert.Equal("123456", s_formatter.FormatObject(123456, options)) 129Assert.Equal("123456", s_formatter.FormatObject(123456, options)) 138Assert.Equal("1.", s_formatter.FormatObject(123456, options)) 141Assert.Equal("1..", s_formatter.FormatObject(123456, options)) 144Assert.Equal("1", s_formatter.FormatObject(123456, options)) 147Assert.Equal("1", s_formatter.FormatObject(123456, options))