66
77public static class __CSharpRepl_RuntimeHelper
88{
9- public static SpanOutput HandleSpanOutput < T > ( System . Span < T > span ) => SpanOutput . Create < T > ( span , false ) ;
10- public static SpanOutput HandleSpanOutput < T > ( System . ReadOnlySpan < T > span ) => SpanOutput . Create ( span , true ) ;
9+ public static SpanOutput HandleSpanOutput < T > ( System . Span < T > span ) => SpanOutput . Create < T > ( span , typeof ( System . Span < T > ) ) ;
10+ public static SpanOutput HandleSpanOutput < T > ( System . ReadOnlySpan < T > span ) => SpanOutput . Create ( span , typeof ( System . ReadOnlySpan < T > ) ) ;
1111
12- public static CharSpanOutput HandleSpanOutput ( System . Span < char > span ) => CharSpanOutput . Create ( span , false ) ;
13- public static CharSpanOutput HandleSpanOutput ( System . ReadOnlySpan < char > span ) => CharSpanOutput . Create ( span , true ) ;
12+ public static CharSpanOutput HandleSpanOutput ( System . Span < char > span ) => CharSpanOutput . Create ( span , typeof ( System . Span < char > ) ) ;
13+ public static CharSpanOutput HandleSpanOutput ( System . ReadOnlySpan < char > span ) => CharSpanOutput . Create ( span , typeof ( System . ReadOnlySpan < char > ) ) ;
14+
15+ public static SpanOutput HandleMemoryOutput < T > ( System . Memory < T > memory ) => SpanOutput . Create < T > ( memory . Span , typeof ( System . Memory < T > ) ) ;
16+ public static SpanOutput HandleMemoryOutput < T > ( System . ReadOnlyMemory < T > memory ) => SpanOutput . Create ( memory . Span , typeof ( System . ReadOnlyMemory < T > ) ) ;
17+
18+ public static CharSpanOutput HandleMemoryOutput ( System . Memory < char > memory ) => CharSpanOutput . Create ( memory . Span , typeof ( System . Memory < char > ) ) ;
19+ public static CharSpanOutput HandleMemoryOutput ( System . ReadOnlyMemory < char > memory ) => CharSpanOutput . Create ( memory . Span , typeof ( System . ReadOnlyMemory < char > ) ) ;
1420
1521 public static RefStructOutput HandleRefStructOutput ( string text ) => new ( text ) ;
1622
17- public abstract class SpanOutputBase ( int originalLength , bool spanWasReadOnly )
23+ public abstract class SpanOutputBase ( int originalLength , System . Type originalType )
1824 : System . Collections . IEnumerable
1925 {
2026 public readonly int OriginalLength = originalLength ;
21- public readonly bool SpanWasReadOnly = spanWasReadOnly ;
27+ public readonly System . Type OriginalType = originalType ;
2228
2329 //Necessary for correct output formatting.
2430 public int Count => OriginalLength ;
2531
2632 public abstract System . Collections . IEnumerator GetEnumerator ( ) ;
2733 }
2834
29- public sealed class SpanOutput ( System . Array array , int originalLength , bool spanWasReadOnly )
30- : SpanOutputBase ( originalLength , spanWasReadOnly )
35+ public sealed class SpanOutput ( System . Array array , int originalLength , System . Type originalType )
36+ : SpanOutputBase ( originalLength , originalType )
3137 {
3238 private const int MaxLength = 1024 ;
3339
34- public readonly System . Array Array = array ;
40+ private readonly System . Array array = array ;
3541
36- public override System . Collections . IEnumerator GetEnumerator ( ) => Array . GetEnumerator ( ) ;
42+ public override System . Collections . IEnumerator GetEnumerator ( ) => array . GetEnumerator ( ) ;
3743
38- public static SpanOutput Create < T > ( System . ReadOnlySpan < T > span , bool spanWasReadOnly ) => new (
44+ public static SpanOutput Create < T > ( System . ReadOnlySpan < T > span , System . Type originalType ) => new (
3945 span [ ..System . Math . Min ( MaxLength , span . Length ) ] . ToArray ( ) ,
4046 span . Length ,
41- spanWasReadOnly ) ;
47+ originalType ) ;
4248 }
4349
44- public sealed class CharSpanOutput ( string text , int originalLength , bool spanWasReadOnly )
45- : SpanOutputBase ( originalLength , spanWasReadOnly )
50+ public sealed class CharSpanOutput ( string text , int originalLength , System . Type originalType )
51+ : SpanOutputBase ( originalLength , originalType )
4652 {
4753 private const int MaxLength = 10_000 ;
4854
4955 public readonly string Text = text ;
5056
5157 public override System . Collections . IEnumerator GetEnumerator ( ) => Text . GetEnumerator ( ) ;
5258
53- public static CharSpanOutput Create ( System . ReadOnlySpan < char > span , bool spanWasReadOnly )
59+ public static CharSpanOutput Create ( System . ReadOnlySpan < char > span , System . Type originalType )
5460 {
5561 var len = System . Math . Min ( MaxLength , span . Length ) ;
5662 System . Span < char > buffer = stackalloc char [ len ] ;
@@ -61,7 +67,7 @@ public static CharSpanOutput Create(System.ReadOnlySpan<char> span, bool spanWas
6167 buffer [ ^ 2 ] = '.' ;
6268 buffer [ ^ 3 ] = '.' ;
6369 }
64- return new ( buffer . ToString ( ) , span . Length , spanWasReadOnly ) ;
70+ return new ( buffer . ToString ( ) , span . Length , originalType ) ;
6571 }
6672 }
6773
0 commit comments