File tree Expand file tree Collapse file tree 1 file changed +2
-4
lines changed
snippets/csharp/how-to/safelycast/patternmatching Expand file tree Collapse file tree 1 file changed +2
-4
lines changed Original file line number Diff line number Diff line change @@ -25,15 +25,13 @@ static void Main(string[] args)
2525
2626 TestForMammals ( g ) ;
2727
28- // Use the as operator to test
29- // an incompatible type.
3028 SuperNova sn = new SuperNova ( ) ;
3129 TestForMammals ( sn ) ;
3230 }
3331
3432 static void FeedMammals ( Animal a )
3533 {
36- // Use the is operator to verify the type.
34+ // Use the is operator to verify the type
3735 // before performing a cast.
3836 if ( a is Mammal m )
3937 {
@@ -43,7 +41,7 @@ static void FeedMammals(Animal a)
4341
4442 static void TestForMammals ( object o )
4543 {
46- // Use the as operator and test for null
44+ // Alternatively, use the as operator and test for null
4745 // before referencing the variable.
4846 if ( o is Mammal m )
4947 {
You can’t perform that action at this time.
0 commit comments