tailieunhanh - Apress introducing ASP.Net 4.0 with visual studio 2010_3

Tham khảo tài liệu 'apress introducing with visual studio 2010_3', công nghệ thông tin, kỹ thuật lập trình phục vụ nhu cầu học tập, nghiên cứu và làm việc hiệu quả | CHAPTER 3 LANGUAGE AND DYNAMIC CHANGES public class Testclass . public void Method1 Compile the application and examine the IL using ILDASM. You will find something similar to the following .method private hidebysig static void Main string args cil managed .entrypoint Code size 15 0xf .maxstack 1 .locals init 0 class t IL_0000 nop IL_0001 newobj instance void .ctor IL_0006 IL_0007 IL_0008 callvirt instance void Method1 IL_000d nop IL_000e ret end of method Program Main However if we alter our t variable to the following dynamic t new TestClass . then the IL will look very different I have removed some of the IL to save some trees class mscorlib 1 class IL_003a call class 1 0 class 1 class mscorlib 2 class object Create class IL_003f stsfld class .CallSite 1 class mscorlib 2 class object Main oSiteContainer0 p__Site1 IL_0056 callvirt instance void class mscorlib 2 class object Invoke 0 1 Whoa what is happening here Well the short answer is that calls to dynamic methods are sent to the Dynamic Language Runtime for resolution. It is time to take a look into how the DLR works. 57 CHAPTER 3 LANGUAGE AND DYNAMIC CHANGES Dynamic Language Runtime DLR The Dynamic Language Runtime DLR is behind all the cool dynamic functionality and sits just above the core .NET framework. The DLR s job is basically to .

TỪ KHÓA LIÊN QUAN