diff --git a/docs/csharp/misc/cs0077.md b/docs/csharp/misc/cs0077.md index e8516b36d8c40..750d8b295f7cc 100644 --- a/docs/csharp/misc/cs0077.md +++ b/docs/csharp/misc/cs0077.md @@ -21,11 +21,7 @@ However, using [pattern matching](../fundamentals/functional/pattern-matching.md ```csharp // CS0077.cs using System; - -class C -{ -} - + struct S { } @@ -34,17 +30,15 @@ class M { public static void Main() { - object o1, o2; - C c; + object o; S s; + + o = new S(); - o1 = new C(); - o2 = new S(); - - s = o2 as S; // CS0077, S is not a reference type + s = o as S; // CS0077, S is not a reference type // Use pattern matching instead of as - if (o2 is S sValue) + if (o is S sValue) { s = sValue; }