Skip to content

Commit cb61a07

Browse files
authored
Fixed links to the ref struct doc (#4146)
1 parent 64cf132 commit cb61a07

File tree

5 files changed

+7
-7
lines changed

5 files changed

+7
-7
lines changed

xml/System/Memory`1.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
5353
## Remarks
5454
55-
Like <xref:System.Span%601>, `Memory<T>` represents a contiguous region of memory. Unlike <xref:System.Span%601>, however, `Memory<T>` is not a [ref struct](~/docs/csharp/language-reference/keywords/ref.md#ref-struct-types). This means that `Memory<T>` can be placed on the managed heap, whereas <xref:System.Span%601> cannot. As a result, the `Memory<T>` structure does not have the same restrictions as a <xref:System.Span%601> instance. In particular:
55+
Like <xref:System.Span%601>, `Memory<T>` represents a contiguous region of memory. Unlike <xref:System.Span%601>, however, `Memory<T>` is not a [ref struct](~/docs/csharp/language-reference/builtin-types/struct.md#ref-struct). This means that `Memory<T>` can be placed on the managed heap, whereas <xref:System.Span%601> cannot. As a result, the `Memory<T>` structure does not have the same restrictions as a <xref:System.Span%601> instance. In particular:
5656
5757
- It can be used as a field in a class.
5858

xml/System/ReadOnlySpan`1+Enumerator.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ Though the <xref:System.ReadOnlySpan`1> is allocated on the stack, the underlyin
5252
5353
Unlike some other enumerator structures in .NET, the <xref:System.ReadOnlySpan`1.Enumerator>:
5454
55-
- Does not implement the <xref:System.Collections.IEnumerator> or <xref:System.Collections.Generic.IEnumerator`1> interface. This is because <xref:System.ReadOnlySpan`1.Enumerator> is a [ref struct](~/docs/csharp/language-reference/keywords/ref.md#ref-struct-types) and cannot be boxed.
55+
- Does not implement the <xref:System.Collections.IEnumerator> or <xref:System.Collections.Generic.IEnumerator`1> interface. This is because <xref:System.ReadOnlySpan`1.Enumerator> is a [ref struct](~/docs/csharp/language-reference/builtin-types/struct.md#ref-struct) and cannot be boxed.
5656
5757
- Does not include a `Reset` method, which can set the enumerator to its initial position before the first element in the span. (The <xref:System.Collections.IEnumerator.Reset?displayProperty=nameWithType> method must be implemented as part of the interface, but most implementors either throw an exception or provide no implementation.)
5858

xml/System/ReadOnlySpan`1.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
<typeparam name="T">The type of items in the <see cref="T:System.ReadOnlySpan`1" />.</typeparam>
4545
<summary>Provides a type-safe and memory-safe read-only representation of a contiguous region of arbitrary memory.</summary>
4646
<remarks>
47-
<format type="text/markdown"><![CDATA[`ReadOnlySpan<T>` is a [ref struct](~/docs/csharp/language-reference/keywords/ref.md#ref-struct-types) that is allocated on the stack and can never escape to 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, captured in lambda expressions, assigned to variables of type <xref:System.Object>, assigned to `dynamic` variables, and they cannot implement any interface type.
47+
<format type="text/markdown"><![CDATA[`ReadOnlySpan<T>` is a [ref struct](~/docs/csharp/language-reference/builtin-types/struct.md#ref-struct) that is allocated on the stack and can never escape to 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, captured in lambda expressions, assigned to variables of type <xref:System.Object>, assigned to `dynamic` variables, and they cannot implement any interface type.
4848
4949
A `ReadOnlySpan<T>` instance is often used to reference the elements of an array or a portion of an array. Unlike an array, however, a `ReadOnlySpan<T>` instance can point to managed memory, native memory, or memory managed on the stack.]]></format>
5050
</remarks>

xml/System/Span`1.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
<remarks>
4747
<format type="text/markdown"><![CDATA[
4848
49-
`Span<T>` is a [ref struct](~/docs/csharp/language-reference/keywords/ref.md#ref-struct-types) 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>.
49+
`Span<T>` is a [ref struct](~/docs/csharp/language-reference/builtin-types/struct.md#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>.
5050
5151
> [!IMPORTANT]
5252
> 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.
@@ -394,7 +394,7 @@ This method copies all of `source` to `destination` even if `source` and `destin
394394
<format type="text/markdown"><![CDATA[
395395
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:
396396
397-
- 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](~/docs/csharp/reference-semantics-with-value-types.md#ref-struct-type) that cannot be boxed and therefore cannot be converted to an <xref:System.Object>.
397+
- 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](~/docs/csharp/language-reference/builtin-types/struct.md#ref-struct) that cannot be boxed and therefore cannot be converted to an <xref:System.Object>.
398398
399399
- If the type of `obj` is not a <xref:System.Span%601>, the method call throws a <xref:System.NotSupportedException>.
400400
@@ -543,7 +543,7 @@ Instead of calling the <xref:System.Span%601.GetEnumerator%2A> method directly,
543543
<remarks>
544544
<format type="text/markdown"><![CDATA[
545545
546-
The `GetPinnableReference` method returns a [ref struct](~/docs/csharp/reference-semantics-with-value-types.md#ref-struct-type). It can be used for pinning a <xref:System.Span%601> in memory. It is required to support the use of a <xref:System.Span%601> within a [fixed](~/docs/csharp/language-reference/keywords/fixed-statement.md) statement.
546+
The `GetPinnableReference` method returns a [ref struct](~/docs/csharp/language-reference/builtin-types/struct.md#ref-struct). It can be used for pinning a <xref:System.Span%601> in memory. It is required to support the use of a <xref:System.Span%601> within a [fixed](~/docs/csharp/language-reference/keywords/fixed-statement.md) statement.
547547
548548
]]></format>
549549
</remarks>

xml/System/Type.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11129,7 +11129,7 @@ GetType(Array).IsAssignableFrom(type)
1112911129
<format type="text/markdown"><![CDATA[
1113011130

1113111131
## Remarks
11132-
Byref-like structures are declared using `ref struct` keyword in C#. An instance of the byref-like structure can't be placed on the managed heap. For more information, see [Ref struct types](~/docs/csharp/language-reference/keywords/ref.md#ref-struct-types).
11132+
Byref-like structures are declared using `ref struct` keyword in C#. An instance of the byref-like structure can't be placed on the managed heap. For more information, see [Ref struct](~/docs/csharp/language-reference/builtin-types/struct.md#ref-struct).
1113311133

1113411134
]]></format>
1113511135
</remarks>

0 commit comments

Comments
 (0)