Skip to content

Commit d0e4f8a

Browse files
dlechRon Petrusha
authored andcommitted
Fix typo in example: s/Box/Unbox/ (#2700)
There is no such thing a Box method. Assuming it is supposed to be Unbox instead.
1 parent 1325860 commit d0e4f8a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

xml/System.Runtime.CompilerServices/Unsafe.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1111,7 +1111,7 @@ The `Unbox<T>` method is simply a wrapper for the IL [unbox](xref:System.Reflect
11111111
The `Unbox<T>` method has an important usage constraint that is not enforced by language compilers and that is the responsibility of the caller. The IL `unbox` instruction returns a controlled-mutability managed pointer. Because .NET and .NET language compilers cannot represent this constraint, the `Unbox<T>` method returns a normal mutable `ref T`. However developers **must not** mutate the returned reference unless they are certain that `T` is a mutable struct type. For example, because the numeric primitives such as <xref:System.Int32> are not mutable struct types, the following code is not suppported:
11121112
11131113
```csharp
1114-
Unsafe.Box<int>(obj) = 30;
1114+
Unsafe.Unbox<int>(obj) = 30;
11151115
```
11161116
11171117
In contrast, a type such as <xref:System.Drawing.Point?<displayProperty=nameWithType> is a mutable struct with public property setters, so the following code is supported:
@@ -1245,4 +1245,4 @@ For more information, see sections III.1.8.1.2.2 ("Controlled-muttability manage
12451245
</Docs>
12461246
</Member>
12471247
</Members>
1248-
</Type>
1248+
</Type>

0 commit comments

Comments
 (0)