Skip to content

Commit d7aceaa

Browse files
authored
use implicit conversion to convert from byte[] to Span<byte> (#2061)
1 parent de614cb commit d7aceaa

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

src/common/System/Span.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ public Span(T[] array)
1717
Length = array.Length;
1818
}
1919

20+
public static implicit operator Span<T>(T[]? array) => array is null ? default : new Span<T>(array);
21+
2022
public int Length { get; }
2123

2224
public T this[int index]

0 commit comments

Comments
 (0)