Skip to content

Commit c47a4a8

Browse files
Remove the unused variables after working on CS0077 (#43368)
1 parent a96b3eb commit c47a4a8

File tree

1 file changed

+6
-12
lines changed

1 file changed

+6
-12
lines changed

docs/csharp/misc/cs0077.md

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,7 @@ However, using [pattern matching](../fundamentals/functional/pattern-matching.md
2121
```csharp
2222
// CS0077.cs
2323
using System;
24-
25-
class C
26-
{
27-
}
28-
24+
2925
struct S
3026
{
3127
}
@@ -34,17 +30,15 @@ class M
3430
{
3531
public static void Main()
3632
{
37-
object o1, o2;
38-
C c;
33+
object o;
3934
S s;
35+
36+
o = new S();
4037

41-
o1 = new C();
42-
o2 = new S();
43-
44-
s = o2 as S; // CS0077, S is not a reference type
38+
s = o as S; // CS0077, S is not a reference type
4539
4640
// Use pattern matching instead of as
47-
if (o2 is S sValue)
41+
if (o is S sValue)
4842
{
4943
s = sValue;
5044
}

0 commit comments

Comments
 (0)