Skip to content

Commit

Permalink
Update workaround
Browse files Browse the repository at this point in the history
  • Loading branch information
cston committed Jun 24, 2022
1 parent 025d883 commit e1aa9e8
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions docs/compilers/CSharp/Compiler Breaking Changes - DotNet 7.md
Original file line number Diff line number Diff line change
Expand Up @@ -145,15 +145,12 @@ static R CreateDefault()
A possible workaround, if the `ref` or `in` argument is not captured in the `ref struct` return value, is to declare the parameter as `scoped ref` or `scoped in`.

```csharp
class Program
{
static R CannotCaptureArg(scoped ref int i) => new R();
static R CannotCaptureArg(scoped ref int i) => new R();

static R Create()
{
int i = 0;
return CannotCaptureArg(ref i); // ok
}
static R Create()
{
int i = 0;
return CannotCaptureArg(ref i); // ok
}
```

Expand Down

0 comments on commit e1aa9e8

Please sign in to comment.