﻿{"id":1403,"date":"2010-11-08T18:58:59","date_gmt":"2010-11-08T10:58:59","guid":{"rendered":"http:\/\/blog.jixin.ntxz.net\/?p=1403"},"modified":"2010-11-08T18:59:00","modified_gmt":"2010-11-08T10:59:00","slug":"net-%e9%9d%99%e6%80%81%e6%b0%b4%e5%8d%b0","status":"publish","type":"post","link":"http:\/\/www.ntxz.net\/?p=1403","title":{"rendered":".Net \u9759\u6001\u6c34\u5370"},"content":{"rendered":"<p>\u6240\u8c13\u7684\u8f6f\u4ef6\u6c34\u5370\u5c31\u662f\u628a\u7a0b\u5e8f\u7684\u7248\u6743\u4fe1\u606f\u548c\u7528\u6237\u8eab\u4efd\u4fe1\u606f\u5d4c\u5165\u5230\u7a0b\u5e8f\u4e2d\u3002\u6839\u636e\u4e0d\u540c\u9636\u6bb5\u5c06\u4fe1\u606f\u5d4c\u5165\u5230\u7a0b\u5e8f\u4e2d\u53ef\u4ee5\u5206\u4e3a\u9759\u6001\u6c34\u5370\u548c\u52a8\u6001\u6c34\u5370\uff0c\u9759\u6001\u6c34\u5370\u662f\u5c06\u4fe1\u606f\u5199\u5728\u4ee3\u7801\u4e2d\uff0c\u800c\u52a8\u6001\u6c34\u5370\u5219\u662f\u5c06\u4fe1\u606f\u4fdd\u5b58\u5728\u7a0b\u5e8f\u7684\u6267\u884c\u72b6\u6001\u4e2d,\u800c\u4e0d\u662f\u7a0b\u5e8f\u6e90\u4ee3\u7801\u672c\u8eab\u3002<\/p>\n<p>[coolcode]<br \/>\nusing System;<br \/>\nusing System.Collections.Generic;<br \/>\nusing System.Linq;<br \/>\nusing System.Text;<\/p>\n<p>namespace HelloWorld<br \/>\n{<br \/>\nclass Program<br \/>\n{<br \/>\nstatic void Main(string[] args)<br \/>\n{<br \/>\nConsole.WriteLine(&#8220;Plz input the string that you want to calculate :&#8221;);<br \/>\nstring in_string=Console.ReadLine();<br \/>\nConsole.WriteLine(Length(in_string));<br \/>\n}<br \/>\nstatic int Length(string str)<br \/>\n{<br \/>\nreturn str.Length;<br \/>\n}<br \/>\n}<br \/>\n}<br \/>\n[\/coolcode]<\/p>\n<p>\u9009\u62e9\u5de5\u5177 IL\u53cd\u6c47\u7f16\u7a0b\u5e8f<br \/>\n\u5bfc\u5165\u7f16\u8bd1\u540e\u751f\u6210\u540e\u7684.exe\u6587\u4ef6\uff0c\u5e76\u8f6c\u50a8<br \/>\n\u5219\u5f97\u5230\u4e0b\u9762\u7684\u4ee3\u7801<\/p>\n<p>[coolcode]<\/p>\n<p>\/\/  Microsoft (R) .NET Framework IL Disassembler.  Version 3.5.30729.1<\/p>\n<p>\/\/ Metadata version: v2.0.50727<br \/>\n.assembly extern mscorlib<br \/>\n{<br \/>\n  .publickeytoken = (B7 7A 5C 56 19 34 E0 89 )                         \/\/ .z\\V.4..<br \/>\n  .ver 2:0:0:0<br \/>\n}<br \/>\n.assembly HelloWorld<br \/>\n{<br \/>\n  .custom instance void [mscorlib]System.Reflection.AssemblyTitleAttribute::.ctor(string) = ( 01 00 0A 48 65 6C 6C 6F 57 6F 72 6C 64 00 00 )    \/\/ &#8230;HelloWorld..<br \/>\n  .custom instance void [mscorlib]System.Reflection.AssemblyDescriptionAttribute::.ctor(string) = ( 01 00 00 00 00 )<br \/>\n  .custom instance void [mscorlib]System.Reflection.AssemblyConfigurationAttribute::.ctor(string) = ( 01 00 00 00 00 )<br \/>\n  .custom instance void [mscorlib]System.Reflection.AssemblyCompanyAttribute::.ctor(string) = ( 01 00 09 4D 69 63 72 6F 73 6F 66 74 00 00 )       \/\/ &#8230;Microsoft..<br \/>\n  .custom instance void [mscorlib]System.Reflection.AssemblyProductAttribute::.ctor(string) = ( 01 00 0A 48 65 6C 6C 6F 57 6F 72 6C 64 00 00 )    \/\/ &#8230;HelloWorld..<br \/>\n  .custom instance void [mscorlib]System.Reflection.AssemblyCopyrightAttribute::.ctor(string) = ( 01 00 1B 43 6F 70 79 72 69 67 68 74 20 C2 A9 20   \/\/ &#8230;Copyright ..<br \/>\n                                                                                                  4D 69 63 72 6F 73 6F 66 74 20 32 30 31 30 00 00 ) \/\/ Microsoft 2010..<br \/>\n  .custom instance void [mscorlib]System.Reflection.AssemblyTrademarkAttribute::.ctor(string) = ( 01 00 00 00 00 )<br \/>\n  .custom instance void [mscorlib]System.Runtime.InteropServices.ComVisibleAttribute::.ctor(bool) = ( 01 00 00 00 00 )<br \/>\n  .custom instance void [mscorlib]System.Runtime.InteropServices.GuidAttribute::.ctor(string) = ( 01 00 24 33 33 38 63 38 39 30 63 2D 38 37 32 66   \/\/ ..$338c890c-872f<br \/>\n                                                                                                  2D 34 38 35 32 2D 39 66 37 36 2D 64 32 31 64 66   \/\/ -4852-9f76-d21df<br \/>\n                                                                                                  35 31 38 35 66 37 30 00 00 )                      \/\/ 5185f70..<br \/>\n  .custom instance void [mscorlib]System.Reflection.AssemblyFileVersionAttribute::.ctor(string) = ( 01 00 07 31 2E 30 2E 30 2E 30 00 00 )             \/\/ &#8230;1.0.0.0..<br \/>\n  \/\/ &#8212; \u4e0b\u5217\u81ea\u5b9a\u4e49\u5c5e\u6027\u4f1a\u81ea\u52a8\u6dfb\u52a0\uff0c\u4e0d\u8981\u53d6\u6d88\u6ce8\u91ca &#8212;&#8212;-<br \/>\n  \/\/  .custom instance void [mscorlib]System.Diagnostics.DebuggableAttribute::.ctor(valuetype [mscorlib]System.Diagnostics.DebuggableAttribute\/DebuggingModes) = ( 01 00 07 01 00 00 00 00 )<br \/>\n  .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilationRelaxationsAttribute::.ctor(int32) = ( 01 00 08 00 00 00 00 00 )<br \/>\n  .custom instance void [mscorlib]System.Runtime.CompilerServices.RuntimeCompatibilityAttribute::.ctor() = ( 01 00 01 00 54 02 16 57 72 61 70 4E 6F 6E 45 78   \/\/ &#8230;.T..WrapNonEx<br \/>\n                                                                                                             63 65 70 74 69 6F 6E 54 68 72 6F 77 73 01 )       \/\/ ceptionThrows.<br \/>\n  .hash algorithm 0x00008004<br \/>\n  .ver 1:0:0:0<br \/>\n}<br \/>\n.module HelloWorld.exe<br \/>\n\/\/ MVID: {A9CAEE52-9DC8-47CB-BB6F-CF5E9CD08A25}<br \/>\n.imagebase 0x00400000<br \/>\n.file alignment 0x00000200<br \/>\n.stackreserve 0x00100000<br \/>\n.subsystem 0x0003       \/\/ WINDOWS_CUI<br \/>\n.corflags 0x00000001    \/\/  ILONLY<br \/>\n\/\/ Image base: 0x03330000<\/p>\n<p>\/\/ =============== CLASS MEMBERS DECLARATION ===================<br \/>\n.class private auto ansi beforefieldinit HelloWorld.Program<br \/>\n       extends [mscorlib]System.Object<br \/>\n{<br \/>\n  .method private hidebysig static void  Main(string[] args) cil managed<br \/>\n  {<br \/>\n    .entrypoint<br \/>\n    \/\/ \u4ee3\u7801\u5927\u5c0f       31 (0x1f)<br \/>\n    .maxstack  1<br \/>\n    .locals init ([0] string in_string)<br \/>\n    IL_0000:  nop<br \/>\n    IL_0001:  ldstr      &#8220;Plz input the string that you want to calculate :&#8221;<br \/>\n    IL_0006:  call       void [mscorlib]System.Console::WriteLine(string)<br \/>\n    IL_000b:  nop<br \/>\n    IL_000c:  call       string [mscorlib]System.Console::ReadLine()<br \/>\n    IL_0011:  stloc.0<br \/>\n    IL_0012:  ldloc.0<br \/>\n    IL_0013:  call       int32 HelloWorld.Program::Length(string)<br \/>\n    IL_0018:  call       void [mscorlib]System.Console::WriteLine(int32)<br \/>\n    IL_001d:  nop<br \/>\n    IL_001e:  ret<br \/>\n  } \/\/ end of method Program::Main<br \/>\n  .method private hidebysig static int32<br \/>\n          Length(string str) cil managed<br \/>\n  {<br \/>\n    \/\/ \u4ee3\u7801\u5927\u5c0f       12 (0xc)<br \/>\n    .maxstack  1<br \/>\n    .locals init ([0] int32 CS$1$0000)<br \/>\n    IL_0000:  nop<br \/>\n    IL_0001:  ldarg.0<br \/>\n    IL_0002:  callvirt   instance int32 [mscorlib]System.String::get_Length()<br \/>\n    IL_0007:  stloc.0<br \/>\n    IL_0008:  br.s       IL_000a<br \/>\n    IL_000a:  ldloc.0<br \/>\n    IL_000b:  ret<br \/>\n  } \/\/ end of method Program::Length<br \/>\n  .method public hidebysig specialname rtspecialname<br \/>\n          instance void  .ctor() cil managed<br \/>\n  {<br \/>\n    \/\/ \u4ee3\u7801\u5927\u5c0f       7 (0x7)<br \/>\n    .maxstack  8<br \/>\n    IL_0000:  ldarg.0<br \/>\n    IL_0001:  call       instance void [mscorlib]System.Object::.ctor()<br \/>\n    IL_0006:  ret<br \/>\n  } \/\/ end of method Program::.ctor<br \/>\n} \/\/ end of class HelloWorld.Program<\/p>\n<p>\/\/ =============================================================<br \/>\n\/\/ *********** \u53cd\u6c47\u7f16\u5b8c\u6210 ***********************<br \/>\n\/\/ \u8b66\u544a: \u521b\u5efa\u4e86 Win32 \u8d44\u6e90\u6587\u4ef6 C:\\Documents and Settings\\Administrator\\My Documents\\Visual Studio 2008\\Projects\\HelloWorld\\HelloWorld\\bin\\Debug\\121.res<br \/>\n[\/coolcode]<\/p>\n<p>\u5728\u8fd9\u4e24\u884c<br \/>\n    IL_000a:  ldloc.0<br \/>\n    IL_000b:  ret<br \/>\n\u8fd9\u4ef6\u63d2\u5165\u6c34\u5370\u4fe1\u606f<\/p>\n<p>[coolcode]<br \/>\n\/* \/\/\u6c34\u5370\u4ee3\u7801 \u5f00\u59cb\u7aef<br \/>\nIL_000b: .locals init(int32 returnvalue)<br \/>\nIL_000c: stloc returnvalue<br \/>\nIL_000d: ldstr &#8220;DEBUG -current value is &#8216;{0}'&#8221;<br \/>\nIL_000f: ldstr &#8220;Copyright BUPTISC&#8221;<br \/>\nIL_0010: call void [mscorlib]System.Console::WriteLine(string,object)<br \/>\nIL_0011: ldloc returnvalue<br \/>\n\/\/\u6c34\u5370\u4ee3\u7801 \u7ed3\u675f\u7aef*\/<br \/>\n[\/coolcode]<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6240\u8c13\u7684\u8f6f\u4ef6\u6c34\u5370\u5c31\u662f\u628a\u7a0b\u5e8f\u7684\u7248\u6743\u4fe1\u606f\u548c\u7528\u6237\u8eab\u4efd\u4fe1\u606f\u5d4c\u5165\u5230\u7a0b\u5e8f\u4e2d\u3002\u6839\u636e\u4e0d\u540c\u9636\u6bb5\u5c06\u4fe1\u606f\u5d4c\u5165\u5230\u7a0b\u5e8f\u4e2d\u53ef\u4ee5\u5206\u4e3a\u9759\u6001\u6c34\u5370\u548c [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[293],"class_list":["post-1403","post","type-post","status-publish","format-standard","hentry","category-csharp","tag-293"],"views":447,"_links":{"self":[{"href":"http:\/\/www.ntxz.net\/index.php?rest_route=\/wp\/v2\/posts\/1403","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.ntxz.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.ntxz.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.ntxz.net\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/www.ntxz.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1403"}],"version-history":[{"count":1,"href":"http:\/\/www.ntxz.net\/index.php?rest_route=\/wp\/v2\/posts\/1403\/revisions"}],"predecessor-version":[{"id":1404,"href":"http:\/\/www.ntxz.net\/index.php?rest_route=\/wp\/v2\/posts\/1403\/revisions\/1404"}],"wp:attachment":[{"href":"http:\/\/www.ntxz.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1403"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.ntxz.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1403"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.ntxz.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1403"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}