When I use is operator why there is only a null-check in IL code?
问题 I was wondering how is is operator implemented in C# .And I have written a simple test program (nothing special, just for demonstration purposes): class Base { public void Display() { Console.WriteLine("Base"); } } class Derived : Base { } class Program { static void Main(string[] args) { var d = new Derived(); if (d is Base) { var b = (Base) d; d.Display(); } } } And looked at the generated IL code: .method private hidebysig static void Main(string[] args) cil managed { .entrypoint // Code