-
Notifications
You must be signed in to change notification settings - Fork 221
Expand file tree
/
Copy pathSharpLabObjectExtensions.cs
More file actions
32 lines (26 loc) · 1.4 KB
/
SharpLabObjectExtensions.cs
File metadata and controls
32 lines (26 loc) · 1.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
using System;
using System.ComponentModel;
using SharpLab.Runtime.Internal;
public static class SharpLabObjectExtensions {
// LinqPad/etc compatibility only
[EditorBrowsable(EditorBrowsableState.Never)]
public static T Dump<T>(this T value) {
Output.Write(new SimpleInspection("Dump", RuntimeServices.ValuePresenter.ToStringBuilder(value, ValuePresenterLimits.InspectValue)));
return value;
}
public static void Inspect<T>(this T value, string? title = null) {
Output.Write(new SimpleInspection(title ?? "Inspect", RuntimeServices.ValuePresenter.ToStringBuilder(value, ValuePresenterLimits.InspectValue)));
/*var lineNumber = ContainerFlow.GetLastReportedLineNumber();
if (lineNumber != null)
ContainerFlow.ReportValue(value, title, lineNumber.Value);*/
}
public static void Inspect<T>(this Span<T> value, string? title = null) {
((ReadOnlySpan<T>)value).Inspect(title);
}
public static void Inspect<T>(this ReadOnlySpan<T> value, string? title = null) {
Output.Write(new SimpleInspection(title ?? "Inspect", RuntimeServices.ValuePresenter.ToStringBuilder(value, ValuePresenterLimits.InspectValue)));
/*var lineNumber = ContainerFlow.GetLastReportedLineNumber();
if (lineNumber != null)
ContainerFlow.ReportReadOnlySpanValue(value, title, lineNumber.Value);*/
}
}