扫一扫
分享文章到微信
扫一扫
关注官方公众号
至顶头条
// Program.cs public static class EMClass { public static int ToInt32Ext(this string s) { return Int32.Parse(s); } public static int ToInt32Static(string s) { return Int32.Parse(s); } } class Program { static void Main(string[] args) { string s = "9"; int i = s.ToInt32Ext(); // LINE A Console.WriteLine(i); int j = EMClass.ToInt32Static(s); // LINE B Console.WriteLine(j); Console.ReadLine(); } } |
Csc.exe /reference:"C:\Program Files\LINQ Preview\Bin \System.Data.DLINQ.dll" /reference:C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.dll /reference:"C:\Program Files\LINQ Preview\Bin\System.Query.dll" /reference:"C:\Program Files\LINQ Preview\Bin\System.Xml.XLINQ.dll" /target:exe Program.cs |
.method public hidebysig static int32 ToInt32Ext(string s) cil managed { .custom instance void [System.Query]System.Runtime .CompilerServices.ExtensionAttribute::.ctor() = ( 01 00 00 00 ) // Code size 12 (0xc) .maxstack 1 .locals init ([0] int32 CSCODE_REPLACEMENT 200) IL_0000: nop IL_0001: ldarg.0 IL_0002: call int32 [mscorlib]System.Int32::Parse(string) IL_0007: stloc.0 IL_0008: br.s IL_000a IL_000a: ldloc.0 IL_000b: ret } // end of method EMClass::ToInt32Ext |
.method public hidebysig static int32 ToInt32Static(string s) cil managed { // Code size 12 (0xc) .maxstack 1 .locals init ([0] int32 CSCODE_REPLACEMENT 300) IL_0000: nop IL_0001: ldarg.0 IL_0002: call int32 [mscorlib]System.Int32::Parse(string) IL_0007: stloc.0 IL_0008: br.s IL_000a IL_000a: ldloc.0 IL_000b: ret } // end of method EMClass::ToInt32Static |
如果您非常迫切的想了解IT领域最新产品与技术信息,那么订阅至顶网技术邮件将是您的最佳途径之一。
现场直击|2021世界人工智能大会
直击5G创新地带,就在2021MWC上海
5G已至 转型当时——服务提供商如何把握转型的绝佳时机
寻找自己的Flag
华为开发者大会2020(Cloud)- 科技行者