Đang chuẩn bị liên kết để tải về tài liệu:
Apress introducing ASP.Net 4.0 with visual studio 2010_3
Đang chuẩn bị nút TẢI XUỐNG, xin hãy chờ
Tải xuống
Tham khảo tài liệu 'apress introducing asp.net 4.0 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 Chapter3.DynamicComplex.TestClass t IL_0000 nop IL_0001 newobj instance void Chapter3.DynamicComplex.TestClass .ctor IL_0006 stloc.0 IL_0007 ldloc.0 IL_0008 callvirt instance void Chapter3.DynamicComplex.TestClass 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 t.Method1 . then the IL will look very different I have removed some of the IL to save some trees class mscorlib System.Collections.Generic.IEnumerable 1 class Microsoft.CSharp Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo IL_003a call class System.Core System.Runtime.CompilerServices.CallSite 1 0 class System.Core System.Runtime.CompilerServices.CallSite 1 class mscorlib System.Action 2 class System.Core System.Runtime.CompilerServices.CallSite object Create class System.Core System.Runtime.CompilerServices.CallSiteBinder IL_003f stsfld class System.Core System.Runtime.CompilerServices .CallSite 1 class mscorlib System.Action 2 class System.Core System.Runtime.CompilerServices.CallSite object Chapter3.DynamicComplex.Program Main oSiteContainer0 p__Site1 IL_0056 callvirt instance void class mscorlib System.Action 2 class System.Core System.Runtime.CompilerServices.CallSite 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 .