提交 6827a7c6 编写于 作者: R Rikki Gibson

Fix nullability of DangerousCreateFromUnderlyingArray

上级 d8f772c1
......@@ -6,6 +6,7 @@
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.IO;
using System.Linq;
using System.Reflection;
......@@ -544,10 +545,10 @@ internal static T[] DangerousGetUnderlyingArray<T>(this ImmutableArray<T> array)
internal static ReadOnlySpan<T> AsSpan<T>(this ImmutableArray<T> array)
=> array.DangerousGetUnderlyingArray();
internal static ImmutableArray<T> DangerousCreateFromUnderlyingArray<T>(ref T[] array)
internal static ImmutableArray<T> DangerousCreateFromUnderlyingArray<T>([MaybeNull] ref T[] array)
{
var proxy = new ImmutableArrayProxy<T> { MutableArray = array };
array = null;
array = null!;
return Unsafe.As<ImmutableArrayProxy<T>, ImmutableArray<T>>(ref proxy);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册