Skip to content

Commit c1e0977

Browse files
authored
Fix ref struct documentation link for Span<T> (dotnet#8838)
1 parent b3f3c48 commit c1e0977

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

xml/System/Span`1.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@
6262
<remarks>
6363
<format type="text/markdown"><![CDATA[
6464
65-
`Span<T>` is a [ref struct](/dotnet/csharp/language-reference/builtin-types/struct#ref-struct) that is allocated on the stack rather than on the managed heap. Ref struct types have a number of restrictions to ensure that they cannot be promoted to the managed heap, including that they can't be boxed, they can't be assigned to variables of type <xref:System.Object>, `dynamic` or to any interface type, they can't be fields in a reference type, and they can't be used across `await` and `yield` boundaries. In addition, calls to two methods, <xref:System.Span%601.Equals(System.Object)> and <xref:System.Span%601.GetHashCode%2A>, throw a <xref:System.NotSupportedException>.
65+
`Span<T>` is a [ref struct](/dotnet/csharp/language-reference/builtin-types/ref-struct) that is allocated on the stack rather than on the managed heap. Ref struct types have a number of restrictions to ensure that they cannot be promoted to the managed heap, including that they can't be boxed, they can't be assigned to variables of type <xref:System.Object>, `dynamic` or to any interface type, they can't be fields in a reference type, and they can't be used across `await` and `yield` boundaries. In addition, calls to two methods, <xref:System.Span%601.Equals(System.Object)> and <xref:System.Span%601.GetHashCode%2A>, throw a <xref:System.NotSupportedException>.
6666
6767
> [!IMPORTANT]
6868
> Because it is a stack-only type, `Span<T>` is unsuitable for many scenarios that require storing references to buffers on the heap. This is true, for example, of routines that make asynchronous method calls. For such scenarios, you can use the complementary <xref:System.Memory%601?displayProperty=nameWithType> and <xref:System.ReadOnlyMemory%601?displayProperty=nameWithType> types.
@@ -460,7 +460,7 @@ This method copies all of `source` to `destination` even if `source` and `destin
460460
<format type="text/markdown"><![CDATA[
461461
Calls to the <xref:System.Span%601.Equals%2A> method are not supported. Calls to the <xref:System.Span%601.Equals%2A> methods produce either of two results:
462462
463-
- If `obj` is a <xref:System.Span%601>, the method call generates compiler error CS1503: "cannot convert from 'System.Span' to 'object'." This is because <xref:System.Span%601> is a [ref struct](/dotnet/csharp/language-reference/builtin-types/struct#ref-struct) that cannot be boxed and therefore cannot be converted to an <xref:System.Object>.
463+
- If `obj` is a <xref:System.Span%601>, the method call generates compiler error CS1503: "cannot convert from 'System.Span' to 'object'." This is because <xref:System.Span%601> is a [ref struct](/dotnet/csharp/language-reference/builtin-types/ref-struct) that cannot be boxed and therefore cannot be converted to an <xref:System.Object>.
464464
465465
- If the type of `obj` is not a <xref:System.Span%601>, the method call throws a <xref:System.NotSupportedException>.
466466

0 commit comments

Comments
 (0)