<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-5319618319979683940</id><updated>2024-09-02T15:42:42.823+08:00</updated><category term="原创"/><category term="教程"/><category term="转载"/><category term="C#"/><category term="其他"/><category term="新手"/><category term="VB6"/><category term="入门"/><category term="Google"/><category term="软件"/><category term="批处理"/><category term="Blogger API"/><category term="Gdata"/><category term="OAuth"/><category term="blogger"/><category term="windows"/><category term="windows 8"/><category term="Youtube Downloader"/><category term="下载"/><category term="VS"/><category term="windows 8 install"/><category term="资源收集"/><category term="Batch"/><category term="C"/><category term="Google特效"/><category term="Text To Picture"/><category term="google triks"/><category term="vmware"/><category term="下载youtube影片"/><category term="融化屏幕"/><category term="123数字黑洞"/><category term="C++"/><category term="Css"/><category term="Facebook"/><category term="Git"/><category term="Google seach特效"/><category term="Google的小花样"/><category term="IE6倒计时"/><category term="Internet Explorer"/><category term="Java"/><category term="Paint.net"/><category term="QR code"/><category term="VB"/><category term="Virtual Box教程"/><category term="Windows Xp"/><category term="Youtube"/><category term="download"/><category term="dropbox"/><category term="garyng"/><category term="vbs"/><category term="virtual box"/><category term="windows 8 preview"/><category term="共享"/><category term="开源"/><category term="激活"/><category term="算法"/><category term="绿色软件合集"/><category term="编程"/><category term="虚拟机"/><category term="装机必备"/><category term="读心术"/><category term="软件合集"/><category term="0.0.0.0"/><category term="127.0.0.1"/><category term="1980年的1GB和2009年的1GB"/><category term="224.0.0.1"/><category term="255.255.255.255"/><category term="3N+1猜想"/><category term="495数字黑洞"/><category term="495黑洞"/><category term="8.8.4.4"/><category term="8.8.8.8"/><category term="A*"/><category term="ALT"/><category term="Ag"/><category term="Android"/><category term="AutoIt3"/><category term="BT工作原理演示"/><category term="Backtrack"/><category term="Bash"/><category term="Bit torrent"/><category term="CMD"/><category term="CTRL"/><category term="Chrome"/><category term="Chrome Remote Desktop"/><category term="Codepad.org"/><category term="Copy"/><category term="DNS"/><category term="Desktop Spammer"/><category term="Diffuse"/><category term="Doraemon"/><category term="Evernote Clearly"/><category term="Explorer"/><category term="Facebook Chat Triks"/><category term="Facebook如何追踪你在网络上的活动"/><category term="Fake Bsod"/><category term="Free Opener"/><category term="GitHub"/><category term="Github Pages"/><category term="Gmail"/><category term="Gmail改版"/><category term="Google Chrome"/><category term="Google Chrome Speed Test"/><category term="Google DNS"/><category term="HAV"/><category term="HTML"/><category term="Hardware Virtualization Technology"/><category term="Hosts文件修改器.bat"/><category term="IE"/><category term="IE是最好的浏览器"/><category term="ISO"/><category term="KeeCloud"/><category term="KeePass"/><category term="LiberKey"/><category term="Loading Bar"/><category term="Maze"/><category term="NXPowerLite"/><category term="Notepad++"/><category term="PHP"/><category term="Paste"/><category term="PlantVSZombie"/><category term="Prank"/><category term="Printscreen"/><category term="Project Euler"/><category term="PrtScrn"/><category term="Pset"/><category term="Python"/><category term="QR"/><category term="QR码"/><category term="Quick Spec Checker"/><category term="SP1"/><category term="SP3"/><category term="Shift"/><category term="Shortcut Keys"/><category term="Small Basic"/><category term="Sp2"/><category term="Symantec"/><category term="Synergy"/><category term="TOR"/><category term="Telnet的一个Bug"/><category term="Text To Pic"/><category term="Trackers"/><category term="TweakNow PowerPack"/><category term="USB"/><category term="VB6实现Fade效果"/><category term="VT"/><category term="WinMount"/><category term="WinToFlash"/><category term="Windows 7"/><category term="Windows 7 来自未来！"/><category term="Windows 8.1"/><category term="Windows Explorer"/><category term="Windows Live Write"/><category term="Windows Live Writer"/><category term="Windows Live Writer Portable"/><category term="Windows Live Writer 便携版"/><category term="Windows Live Writer免安装版"/><category term="Windows Logo"/><category term="Windows Task Manager 的进化图"/><category term="Windows 主题"/><category term="Windows 历史"/><category term="Windows的达尔文进化图"/><category term="YouTubeSnips"/><category term="any2bat"/><category term="change windows startup pic"/><category term="cmd color"/><category term="cmd debug"/><category term="cmd多种颜色"/><category term="cmd颜色"/><category term="do a barrel roll"/><category term="download vb6"/><category term="e起学习"/><category term="garyngzhongbo"/><category term="google let it snow"/><category term="hosts"/><category term="hosts文件编辑"/><category term="http://howsecureismypassword.net/"/><category term="http://myprogramforum.tk"/><category term="iPad的进化图"/><category term="javascript 游戏"/><category term="kick ass"/><category term="letmebingthatforyou"/><category term="letmegooglethatforyou"/><category term="lmgtfy"/><category term="logon studio"/><category term="meatfighter.com/mario/mario.html"/><category term="pi"/><category term="pi记录"/><category term="plop"/><category term="vb6下载"/><category term="windows 8 Consumer preview"/><category term="windows 8 dev"/><category term="www.geee.net"/><category term="www.ie6countdown.com"/><category term="zhongbo"/><category term="不能正常显示文字"/><category term="为什么搞电脑行业的人这么多空闲时间"/><category term="乱码"/><category term="介绍批处理"/><category term="仿BSOD"/><category term="作系统航空公司"/><category term="修改Service Pack 版本号"/><category term="分享"/><category term="加速"/><category term="卡普雷卡尔黑洞"/><category term="压缩PPT"/><category term="压缩Word"/><category term="压缩办公软件"/><category term="史上最烂的超级玛丽"/><category term="史上最糟糕的网站"/><category term="哈代"/><category term="回归数"/><category term="图片C语言"/><category term="图片元素都动了起来"/><category term="图片写字"/><category term="图片编程"/><category term="圆周率"/><category term="在线代码编译服务"/><category term="多啦A梦"/><category term="字串隐藏"/><category term="学习"/><category term="小蚂蚁病毒"/><category term="屏幕融化"/><category term="工具"/><category term="微软历史"/><category term="微软视窗全家福"/><category term="怎样在Facbook以蓝字留言？"/><category term="怎样把任何文件转换成机器码"/><category term="批处理进度条"/><category term="插件"/><category term="操作系统"/><category term="数字黑洞"/><category term="数学娱乐"/><category term="整人类程序"/><category term="文件夹"/><category term="更名咯！"/><category term="更改开机页面"/><category term="最差的操作系统"/><category term="比较文件"/><category term="水仙花数"/><category term="水仙花数字黑洞"/><category term="注册表"/><category term="滑鼠指标【PointerStick】"/><category term="特殊IP地址"/><category term="用USB随身碟重灌Windows"/><category term="电脑不能显示非Unicode字符"/><category term="电脑优化"/><category term="电脑卡"/><category term="电脑小窍门"/><category term="电脑慢"/><category term="电脑病毒40年"/><category term="破解口令"/><category term="破解口令时间"/><category term="破解密码"/><category term="破解密码时间"/><category term="程序员惯用的解释"/><category term="程序员的一生"/><category term="窗体有阴影"/><category term="线上的植物大战僵尸"/><category term="线上空间"/><category term="网站"/><category term="网页之最"/><category term="聊天内打出图片"/><category term="自由编辑网页"/><category term="荧幕截图"/><category term="获取CMD命令的输出"/><category term="虚拟简报指示棒"/><category term="西绪福斯黑洞"/><category term="设置窗体的透明度"/><category term="资源"/><category term="超强的验证码"/><category term="近藤茂"/><category term="迷宫"/><category term="防毒"/><category term="马来西亚编程论坛"/><title type='text'>Gary&#39;s Zone</title><subtitle type='html'> - Yet another IT blog - </subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://garyngzhongbo.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5319618319979683940/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://garyngzhongbo.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><link rel='next' type='application/atom+xml' href='http://www.blogger.com/feeds/5319618319979683940/posts/default?start-index=26&amp;max-results=25&amp;redirect=false'/><author><name>Gary Ng</name><uri>http://www.blogger.com/profile/00014057672539539340</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>202</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-5319618319979683940.post-1795572719567110739</id><published>2014-10-18T00:33:00.002+08:00</published><updated>2018-03-11T20:04:33.186+08:00</updated><title type='text'>本部落格已经搬迁啦！</title><content type='html'>&lt;h1&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&lt;span style=&quot;font-size: x-large;&quot;&gt;本部落格已经搬迁啦&lt;/span&gt;！&lt;br /&gt;
&lt;br /&gt;
新地址：&lt;strike&gt;&lt;a href=&quot;http://garyng.github.io/&quot;&gt;http://garyng.github.io/ &lt;/a&gt;&lt;/strike&gt;&lt;a href=&quot;http://garyng.github.io/&quot;&gt;http://blog.garyng.xyz/&lt;/a&gt;&lt;br /&gt;
&amp;nbsp;Backup: &lt;a href=&quot;http://garyng.github.io/blog&quot;&gt;http://garyng.github.io/blog&lt;/a&gt;&lt;br /&gt;
&lt;strike&gt;&lt;/strike&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-weight: normal;&quot;&gt;Updated 11/03/2018&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;strike&gt;&lt;a href=&quot;http://garyng.github.io/&quot;&gt;&lt;br /&gt;&lt;/a&gt;7/10/2014&lt;/strike&gt;&lt;br /&gt;
&lt;strike&gt;新地址：&lt;a href=&quot;http://garyszone.me/&quot;&gt;http://garyszone.me/&lt;/a&gt;(PS: 1/6/2015 年到期..谁能捐20USD给我呢...)&lt;/strike&gt;&lt;/div&gt;
&lt;/h1&gt;
&lt;div class=&quot;blogger-post-footer&quot;&gt;&lt;script&gt;
SyntaxHighlighter.highlight();
var linkwithin_site_id = 1130633;
$(&#39;#toTop&#39;).remove();
$(&#39;body&#39;).append(&#39;&lt;div id=&quot;toTop&quot; onclick=&quot;$(\&#39;html,body\&#39;).stop().animate({\&#39;scrollTop\&#39;: 0})&quot;&gt;Top&lt;/div&gt;&#39;);
$(window).on(&#39;scroll&#39;,function(){
if ($(this).scrollTop())
{
$(&#39;#toTop&#39;).fadeIn(&#39;fast&#39;);
}
else
{
$(&#39;#toTop&#39;).fadeOut(&#39;fast&#39;);
}
});
&lt;/script&gt;
&lt;script src=&quot;http://www.linkwithin.com/widget.js&quot;&gt;&lt;/script&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://garyngzhongbo.blogspot.com/feeds/1795572719567110739/comments/default' title='博文评论'/><link rel='replies' type='text/html' href='http://garyngzhongbo.blogspot.com/2014/10/blog-post.html#comment-form' title='1 条评论'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5319618319979683940/posts/default/1795572719567110739'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5319618319979683940/posts/default/1795572719567110739'/><link rel='alternate' type='text/html' href='http://garyngzhongbo.blogspot.com/2014/10/blog-post.html' title='本部落格已经搬迁啦！'/><author><name>Gary Ng</name><uri>http://www.blogger.com/profile/00014057672539539340</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5319618319979683940.post-4409068430653056573</id><published>2014-06-04T13:27:00.001+08:00</published><updated>2014-07-25T23:08:37.981+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="原创"/><category scheme="http://www.blogger.com/atom/ns#" term="教程"/><title type='text'>[教程][Windows] 以FontLink解决某字体中文下乱码的问题</title><content type='html'>笔者最近才装好Windows 8 （记得么—— &lt;a href=&quot;http://garyngzhongbo.blogspot.com/2012/11/usbwindows-8.html&quot; target=&quot;_blank&quot;&gt;[原创][教程] 在USB内直接使用正式版Windows 8&lt;/a&gt;） &lt;br /&gt;
打开Notepad 将字体设置为Consolas 后，输入中文字显示一堆乱码（Windows Live Writer 内也是……）&lt;br /&gt;
Google了很久却无果&lt;br /&gt;
突然想到FontLink 便着手试试&lt;br /&gt;
没想到成功了 xD&lt;br /&gt;
&lt;h1&gt;
【步骤】&lt;/h1&gt;
1、打开regedit&lt;br /&gt;
（Win + R &amp;gt; regedit）&lt;br /&gt;
找到HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\FontLink\SystemLink&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh1Y8tQTz96ZKqbwE6Y_hrlzjciZK04ckHrI43U2G9MgljnlNUXzj3csY1UkcRy-fhllnYCVB_kweFfPs4jtmsfI6ji5Stth534qqinDeVtTCiwKcpa0O_PbFDQC6eDeCUH-Ejye44Rswzv/s1600-h/image%25255B2%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgNWO8V9y5ZwzXF273d_oI1zW_I5GJI64l8t0XDqp7Vv1LfKGBj7jq6wixR55-lqOc06lToK7eXZmOowZW3S_HAZysyqL7G7S72WUCNM77zmA2DzEfBKiSnxMJ2OIBCQo8wkWM91wsAT7uf/?imgmax=800&quot; style=&quot;background-image: none; border: 0px; display: inline; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; title=&quot;image&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
2、在空白处右键，点击New &amp;gt; Multi-String Value&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgGdFxnuuFDi54ljY0Q62KmHvhIGhURLhfWKZjTt2muiYiZyka4Exb4imI_I2l2Ys5VT2IALL3U3FMBVJVJgpjkqrxfk4fY1nOPPICaewRnmiK0YiPe8GkZKfgs01_VaaUg5ojgmuxRT0jI/s1600-h/image%25255B5%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjwEiLU7pV3DiJ-YnxRY9XttVSgoSh648xVWR3ZDpNZblNFRLCiuzrosH2ZXw7RplKwyrKP3g-1cdeaQBY8antu5iDOYbkTeI5w-bN6wfsaOytUJEDHX79mP7Wwk6sLweegp_NGrSaW9ORH/?imgmax=800&quot; style=&quot;background-image: none; border: 0px; display: inline; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; title=&quot;image&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
3、重命名成Consolas&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi-4FnKQTAAJoU-0Z0BhSjVpsB2BDeCZmRktaM4XtUbKKjBy2hvrTju-kQ88Xb9dyDPQew2U5yZZ6Xb1sO7tNo1HUI7t0sMdhV-qtC80CGfCTD63Ppv8kDSPG7zrSqT6cKuq_X-193_RfMF/s1600-h/image%25255B8%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEitXzDj2mmyx-4M5PtAyGeK3tqOEpk9N3x3rUrpi2qt-LOl3ywkbnOUhHYOOzXKyO1m__7RSrf41WzIc2m9HNhg8hlvZSeKiFOWRZpZieBpc20TubYQ-gNAj27HSRNJ4GFWUxFpwbAqpkab/?imgmax=800&quot; style=&quot;background-image: none; border: 0px; display: inline; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; title=&quot;image&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
4、双击打开，输入：&lt;br /&gt;
TAHOMA.TTF&lt;br /&gt;
MSYH.TTC,Microsoft YaHei UI,128,96&lt;br /&gt;
MSYH.TTC,Microsoft YaHei UI&lt;br /&gt;
MSJH.TTC,Microsoft Jhenghei UI,128,96&lt;br /&gt;
MSJH.TTC,Microsoft Jhenghei UI&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgFlBRG50VBPFWXIYn4h-ChbXEyr0jYRi-o9AAqCE7DlSroTWtIXiKiA2eOZVHzFZksmFklVr_fCKMwkfED2PDJqyzOdFFKjJpaIPP3pJRSMWgEmYMQphlbXZIa6caLO2FA7NGebtxRU7jP/s1600-h/image%25255B11%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg1XelIximMy-MRs9eGxfLb611gYndocQHniJ-WqT2uAvOyMQiuSuQXWqQfxQfOrdin_rsLQTwZ_y9NAp3vA2P6-J_N4_t9tf-CtIIHPA5rWu6yviuaK88EpMfzDU-LUmAuEQjDV4I3Zpni/?imgmax=800&quot; style=&quot;background-image: none; border: 0px; display: inline; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; title=&quot;image&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
完成后点击OK&lt;br /&gt;
&lt;br /&gt;
5、重启就可以看到效果了：&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhUukOAJDrIxHLyhxP6mSxjD5SIh9stpTfAMdqqIwmSu0u21q-7XSrDDOd-vr7i5YLTv66kAFdrYe1cZ8KuXQ4aEdhBahJ6WnP-op99cRN1ntQIwGD17meYCSBxG1_9XV0FWFtqbvPIxBY-/s1600-h/image%25255B14%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiRw5fkCjuW8-X0ezL2erNTpOBWvGSd2wEbjxMeocpXAP1eLFyQImSlnQYhzNbXdbm8RwZarq-yhS62xg0ZnxlpI69z0lhXQi7U4ShMTKSrdiRWS6d6whJGTVlj1ZWVN_6qCDdnmFoTvNGa/?imgmax=800&quot; style=&quot;background-image: none; border: 0px; display: inline; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; title=&quot;image&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
PS：笔者我试了好久才弄到的..&lt;br /&gt;
失败品：&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjeyeUNiaAhzUGWoQg3gt_gmYBVxdJoCuKoLx0z00ZQle1BzBGr0lrWXaN-dEzAeoEwrU68U-zrhFYrRxcvbFrZ6nKrjvuHYG7xzv1vC6pYam_qoIT5LSSfaI7vOg6RMJtSL8S4b1N1mM6N/s1600-h/2014-06-04_121246%25255B2%25255D.png&quot;&gt;&lt;img alt=&quot;2014-06-04_121246&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjXHcMaN-LxjTq7fJR6dIuG-Mvno6V2c8I_7kDd6gvUFdG3nMDT7QKmHKJBiT7rfSNAgIeiE6bgbLU2CyFJ_U96ryB0xfdA_appJhv8ZOpqfPr5bGaXhyphenhyphenjDGceJCmZtBc7_2dEH4ow0koJu/?imgmax=800&quot; style=&quot;background-image: none; border: 0px; display: inline; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; title=&quot;2014-06-04_121246&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
PS2：部落格似乎变得越来越慢了..太臃肿了么..&lt;div class=&quot;blogger-post-footer&quot;&gt;&lt;script&gt;
SyntaxHighlighter.highlight();
var linkwithin_site_id = 1130633;
$(&#39;#toTop&#39;).remove();
$(&#39;body&#39;).append(&#39;&lt;div id=&quot;toTop&quot; onclick=&quot;$(\&#39;html,body\&#39;).stop().animate({\&#39;scrollTop\&#39;: 0})&quot;&gt;Top&lt;/div&gt;&#39;);
$(window).on(&#39;scroll&#39;,function(){
if ($(this).scrollTop())
{
$(&#39;#toTop&#39;).fadeIn(&#39;fast&#39;);
}
else
{
$(&#39;#toTop&#39;).fadeOut(&#39;fast&#39;);
}
});
&lt;/script&gt;
&lt;script src=&quot;http://www.linkwithin.com/widget.js&quot;&gt;&lt;/script&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://garyngzhongbo.blogspot.com/feeds/4409068430653056573/comments/default' title='博文评论'/><link rel='replies' type='text/html' href='http://garyngzhongbo.blogspot.com/2014/06/windows-fontlink.html#comment-form' title='0 条评论'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5319618319979683940/posts/default/4409068430653056573'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5319618319979683940/posts/default/4409068430653056573'/><link rel='alternate' type='text/html' href='http://garyngzhongbo.blogspot.com/2014/06/windows-fontlink.html' title='[教程][Windows] 以FontLink解决某字体中文下乱码的问题'/><author><name>Gary Ng</name><uri>http://www.blogger.com/profile/00014057672539539340</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgNWO8V9y5ZwzXF273d_oI1zW_I5GJI64l8t0XDqp7Vv1LfKGBj7jq6wixR55-lqOc06lToK7eXZmOowZW3S_HAZysyqL7G7S72WUCNM77zmA2DzEfBKiSnxMJ2OIBCQo8wkWM91wsAT7uf/s72-c?imgmax=800" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5319618319979683940.post-8398024108415516315</id><published>2014-05-27T20:27:00.002+08:00</published><updated>2014-05-27T20:27:47.359+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="C#"/><category scheme="http://www.blogger.com/atom/ns#" term="原创"/><category scheme="http://www.blogger.com/atom/ns#" term="教程"/><title type='text'>[开源][C#] gVerManager——自动增递你的C#程序版本</title><content type='html'>gVerManager 一个非常简单，用来AssemblyInfo.cs 之中的[assembly: AssemblyVersion(“XX”)]项&lt;br /&gt;
开源版本，源代码：&lt;a href=&quot;https://github.com/garyng/gVerManager&quot; title=&quot;https://github.com/garyng/gVerManager&quot;&gt;https://github.com/garyng/gVerManager&lt;/a&gt;&lt;br /&gt;
&lt;span style=&quot;color: red;&quot;&gt;*需要.net 3.5&lt;/span&gt;&lt;br /&gt;
&lt;h1&gt;
【使用教程】&lt;/h1&gt;
1、到我的github上下载整个repo&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiSv18hOaZA8Q2LncMtKfaootEPqgvVyPfYcNgI7l6-XlAhv5YwCZRZZC1SN4HhYf0IiE03gQiPUUyGkil1SDkqZpNXw_mpU2WwRkSTBBYoX-hfm1a8t8c6NfsGHQe-KoBiK_l52SbjMK76/s1600-h/image%25255B6%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhsGI7E6YwuR9W53lP95R8GPNPnWxuSHcSi89oUIQMYmrps3PHaUaIhYQeTpKjWshwPezmZOCz08js3vWpXAl07dzFSjNAhlmAcwfMObvfcP-mqXOepp71Twz3hOHKjlbVsDdOf0aVqIhco/?imgmax=800&quot; height=&quot;307&quot; style=&quot;background-image: none; border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; title=&quot;image&quot; width=&quot;396&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
2、打开zip文件&lt;br /&gt;
进入gVerManager-master.zip\gVerManager-master\gVerManager\bin\Debug 你会看到gVerManager.exe 的文件&lt;br /&gt;
把它copy 出来&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiOyjou6tN1GRDYkqO3oSpAbkvA8uYkuje6uFnX-RYrrhyphenhyphenJjet_gQyRWeUGKHD6sB_yZe_0UqrNwYO7D3KF7GoT6NBQ8cP6QrKT4Zh2YHA8CCZ2FXwJ0L5ke318Rt4wjNciT7_zBoizdrTf/s1600-h/image%25255B9%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjiTsjiMCgG3cjeO4JJtM7L4wr_COFSBeXLSmlYsHixSTGk-R4bottmTeYmD_82du2iXVDYy2_zuWbxB6Z1xDzqU0OSkXnAs-RbKhBZ9SOSFOPzWGRBrK7OK3_Nj2GzVODrr72RqHTta2Uo/?imgmax=800&quot; height=&quot;512&quot; style=&quot;background-image: none; border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; title=&quot;image&quot; width=&quot;780&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
3、然后打开你的C# Project&lt;br /&gt;
放到你的Debug 目录下&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEglMI-aZLu_UcyAELqqQbW2JlhMfOXEnFS-1BtnhTlylX75WguR9EbmEVyLlxEBoIz6Mg5F5IcXACAp7gKesHqsZU3apK93Nv4WTqcpqh7PxV_Kek6aJOeVuHRWnVPYizaGF1-1I_PDCB5y/s1600-h/image%25255B12%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg7GrJ6Tg3q8HchMFeHdByOdWKjOn657FtscGV4b-m2HxrlShSPvmIQbr3zx82Q2Xl6cSjnv1dPPXsW6_3oL7JXSa3D04kGVBsxBoOemYtIqtuYKJQ5FMlWOBriE_mBfepWiYoOuCVgJF0-/?imgmax=800&quot; height=&quot;294&quot; style=&quot;background-image: none; border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; title=&quot;image&quot; width=&quot;763&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
4、Visual Studio 打开你的Solution&lt;br /&gt;
打开Properties 下的 AssemblyInfo.cs&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh91ySUQv2K2oywdTlJoPJMtsrDrpACQNG3laBqir1zpKso_ovx0nQiny5Kgju3ozGmVqPPXfTu5AuC5pNDk3fzQVf6LKISXSgpCKZZaU8U1ZqKmu1cwA26L8DzoRcM1nMNPdAU0GsURigR/s1600-h/image%25255B16%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiGseMS_K9-9RZYtXugJmSJJHTB0zKRXTXagA3PKOheQon21cG3UDu1KnycOZfApYDIc-Rttm1IKlbg5zkECnO91-P2nRgkYgAtNiIjCxOM5fQCZ2zmPWtX0HDdO1_8Ye0iXwdBPMgiWYO6/?imgmax=800&quot; height=&quot;638&quot; style=&quot;background-image: none; border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; title=&quot;image&quot; width=&quot;379&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
5、把[assembly: AssemblyFileVersion(&quot;1.0.0.0&quot;)]给注释掉&lt;br /&gt;
然后保存&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhUIp4kxQp20MBshkxXbZLRRPhtW0exTJp8W9YYkeOdcbfoqgeJm7n6rz_2918edyXhLus7XRXUsUZ76trG9XIde8zJ5hSTr2sEhPlTnK_Zl-RaWvuYSFt1LWoTTZQRH61kwBRACmi705BK/s1600-h/image%25255B19%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg9RbrnW1v7CoZh5gha9SQM9FmJCeS57yk4wpKi_3J4erovQKjeTlnrZL-5bGxcMpJj6v_M21UOltkeptC5xkDsHWgNe6hY1xwlMBDfnjts8sATNi45ZD7U1E94tadnReTQTgSaXFz3-HF-/?imgmax=800&quot; height=&quot;612&quot; style=&quot;background-image: none; border-bottom: 0px; border-left: 0px; border-right: 0px; border-top: 0px; display: inline; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; title=&quot;image&quot; width=&quot;654&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
6、在Solution Explorer 内右键你的Project&lt;br /&gt;
点击Properties&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEimX1FLNjeWL2ES7afZ4WozFWhiL3FEiN-oS6z0iab33okLrxYmrlHL430DCXrCEswF1lE_yFofBt422Z8h-EiAl-5j8mL4B6MuaNhZnrlebWftC56Ln6qhTdQuNb_fJG0ATxu1_L0PayPU/s1600-h/image%25255B22%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhiyI4rYxRQBxsGao5xS0jPzNJB-tSFCxknaIA4X0UzZthi5C-NrLSC9PaFQm8AXvK5h5efYA8I9FrgQHUx9P8710Vh6oD011EaZjHkRWVGDDtsGo9eiVZj3rahZ4Ci2GX_HoI9bQo1MPPH/?imgmax=800&quot; height=&quot;734&quot; style=&quot;background-image: none; border-bottom: 0px; border-left: 0px; border-right: 0px; border-top: 0px; display: inline; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; title=&quot;image&quot; width=&quot;508&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
7、然后点击Build Events&lt;br /&gt;
在Pre-build event command line 之中输入：&lt;br /&gt;
gVerManager.exe -f &quot;$(ProjectDir)Properties\AssemblyInfo.cs&quot;&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh4UsXGmHclq6YuOCNQF6vHE_5iO0ndoQi1fyQ7JnSOBtgx-8eHQ0nifgQIkc38KVi1RmooJFExh7ug8F2zNuWhGBtChGWrfam350x_JmIDQAO0Ri5YnKMA7o1nJlEG9DmGGldU6UAAUvj0/s1600-h/image%25255B25%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiySqGbEP-T53sLEo2CFS3KzH5-wAJgZ3ieVq1Cl1ZOHh9k_zEeWujZy7FtT5i60qiKgZVaAwvisu5_-H6S5K31aevcbHBTgvmxW6IzvtR9a4RLCD4PQLXBxe9zYxa8JePUaBPlmR-is89d/?imgmax=800&quot; height=&quot;542&quot; style=&quot;background-image: none; border-bottom: 0px; border-left: 0px; border-right: 0px; border-top: 0px; display: inline; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; title=&quot;image&quot; width=&quot;653&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
8、F6试试编译&lt;br /&gt;
然后就可以查看效果了！&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh1OhZMuWKHCCCV6MUkY_P7f7IG5fu5qvOcRPs1sc6jBlgv7Si2ByP04i6dt9oxIsVL0MQPKN_wtZqVdUK9NrI_qG1rOrUa96-oOkmNwKtNm841ofsblTwKaGSc9f1Yk7TJephDvU-p8ZRC/s1600-h/image%25255B28%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgmxiuRxWn4fX0ygihJKpelNcPhvDArBFv6OfR2eKQPLxsGrxV8_InxsoTZF0v1NyBv249LWkHSfxawzB1JvJpxQYUhyTLU9kkqHzo4SmZvvqiO3HAdrtQdT3sMdRZ6Q8i5enLwxHFr_TEm/?imgmax=800&quot; height=&quot;554&quot; style=&quot;background-image: none; border-bottom: 0px; border-left: 0px; border-right: 0px; border-top: 0px; display: inline; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; title=&quot;image&quot; width=&quot;679&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
注：久违的更新！xD&lt;div class=&quot;blogger-post-footer&quot;&gt;&lt;script&gt;
SyntaxHighlighter.highlight();
var linkwithin_site_id = 1130633;
$(&#39;#toTop&#39;).remove();
$(&#39;body&#39;).append(&#39;&lt;div id=&quot;toTop&quot; onclick=&quot;$(\&#39;html,body\&#39;).stop().animate({\&#39;scrollTop\&#39;: 0})&quot;&gt;Top&lt;/div&gt;&#39;);
$(window).on(&#39;scroll&#39;,function(){
if ($(this).scrollTop())
{
$(&#39;#toTop&#39;).fadeIn(&#39;fast&#39;);
}
else
{
$(&#39;#toTop&#39;).fadeOut(&#39;fast&#39;);
}
});
&lt;/script&gt;
&lt;script src=&quot;http://www.linkwithin.com/widget.js&quot;&gt;&lt;/script&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://garyngzhongbo.blogspot.com/feeds/8398024108415516315/comments/default' title='博文评论'/><link rel='replies' type='text/html' href='http://garyngzhongbo.blogspot.com/2014/05/c-gvermanagerc.html#comment-form' title='0 条评论'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5319618319979683940/posts/default/8398024108415516315'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5319618319979683940/posts/default/8398024108415516315'/><link rel='alternate' type='text/html' href='http://garyngzhongbo.blogspot.com/2014/05/c-gvermanagerc.html' title='[开源][C#] gVerManager——自动增递你的C#程序版本'/><author><name>Gary Ng</name><uri>http://www.blogger.com/profile/00014057672539539340</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhsGI7E6YwuR9W53lP95R8GPNPnWxuSHcSi89oUIQMYmrps3PHaUaIhYQeTpKjWshwPezmZOCz08js3vWpXAl07dzFSjNAhlmAcwfMObvfcP-mqXOepp71Twz3hOHKjlbVsDdOf0aVqIhco/s72-c?imgmax=800" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5319618319979683940.post-4460471507088826679</id><published>2014-03-22T10:17:00.003+08:00</published><updated>2014-03-22T10:17:16.723+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="共享"/><category scheme="http://www.blogger.com/atom/ns#" term="原创"/><category scheme="http://www.blogger.com/atom/ns#" term="教程"/><category scheme="http://www.blogger.com/atom/ns#" term="文件夹"/><title type='text'>[教程] 在Windows 7 下共享文件/文件夹</title><content type='html'>如果你想要在两台不同的电脑上传输东西的话，而且你有没有任何外挂硬盘/闪盘等， 你该怎么办？&lt;br /&gt;
很简单！靠Windows 自带的共享功能！&lt;br /&gt;
&lt;blockquote class=&quot;bq_warning&quot;&gt;
在一切进行之前&lt;br /&gt;
请确定你的两台/多台电脑都在同一个网络上&lt;br /&gt;
&lt;blockquote class=&quot;bq_info&quot;&gt;
注：该网络不一定需要连接外网的功能（就是不一定需要internet access）&lt;/blockquote&gt;
&lt;/blockquote&gt;
&lt;br /&gt;
&lt;blockquote class=&quot;bq_info&quot;&gt;
笔者运行环境：&lt;br /&gt;
Windows 7 Ultimate x86&lt;/blockquote&gt;
&lt;h1&gt;
【设置Sharing Option】&lt;/h1&gt;
1、打开Control Panel&lt;br /&gt;
2、点击Network and Internet&lt;br /&gt;
&lt;blockquote class=&quot;bq_info&quot;&gt;
注：如果你看到不一样的显示方式的话&lt;br /&gt;
请将上方的View By转换成Category&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh8qFu65NS8gAyS-VFuaXXOISzo4-lr45HdpXZMkpm7wixjV14mejUBU15XKGXLpKvBaEzqrr_A78mrogDkrsCo_1pcsXXHhU-TbSZQ7LIPuYsJ6NoI-tMx0xUjnSOvbyETygcuIomH3nNP/s1600-h/image%25255B5%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgzH0-g1-bC9HIUtJOSVdDKPsGok6lE5R1wwRYeDd04dzb92Mnf8TyRzuwkbZFK7unPQnhMktpCcLm2G3gJ33VA0PBo4OHU0uW80BOg_OUMu8C_W5-y7kDMqp3Het81kQ5rlpjoGe-WDz43/?imgmax=800&quot; height=&quot;232&quot; style=&quot;background-image: none; border-width: 0px; display: inline; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; title=&quot;image&quot; width=&quot;786&quot; /&gt;&lt;/a&gt;&lt;/blockquote&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiAitveXi57gLWBy1YJOInyVG65xtSI0Av6kGKsrRLmmMKT6xiX9PGMJl0FavUHlctraTWLqu0tF6wIL4n1Aod0M-X0M4hzZxFqokSTaKHHMQqjzAXGXdnogCVXnAQm_V-ZjPthQWqKvohv/s1600-h/image%25255B2%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgjBjGiXgx25WX1-18zUxFO_PUz35dFDUa80Ejn_f4Ihej1UXBM2YV7o85OUjUBPrSpP2tgzCBYIvcUy3QRc9YkVvg4YGIgn6cBkJRnMkuvFV6Hiae0iqpIMFjgpVcsNuCTzPPV90z1Ea7P/?imgmax=800&quot; style=&quot;background-image: none; border-width: 0px; display: inline; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; title=&quot;image&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
3、点击 Network and Sharing Center&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg_dKXCt1aHM3JP9uijUfkiL8XAvDl_9Y5dSuQuXUwTtwJzl5lsW5ZiiQrsu5FoSjSXb_tscumdGTOU2iXFfifQ916zOWEiwL2wNhOX-DcSIhwxV1S2Oq81t2Yd-7zU4X6RN4NR3cKQC6-X/s1600-h/image%25255B8%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjJWlC6Yjtcy_A06y4UXZ5l8mlNNzumXoQk2jOLyVNaecgWfiOKaaS32Kl1GxEQPh35xG7ODEgP_jwqKcCsNJYEsqiKWMSuDnhCD0JCVSy7iaqv_oD1ZBj6zfAaqgNoxv4ZHTqUWQvMNAM0/?imgmax=800&quot; height=&quot;210&quot; style=&quot;background-image: none; border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; title=&quot;image&quot; width=&quot;603&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
4、点击Choose homegroup and sharing option&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgHraW2OC2eNlXu60VqFHHtaf6bU-33Efw6vt-yCpNnl0WEXeJRMgqqz9kf93wHnM-x-BeJ33_NXA6kSQND7lFQP8oM8flNaeDItbV7F66MBXh4CP8qNYVLYQPMOaBNnuv8UfX1zzLtQ3Ae/s1600-h/image%25255B11%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjR9W9LdX5TDS7GKZCQEZhe0ZelqeKuY5aZHZ98U9D682Vyi1ByVDM__6Vt-3fexxfL_wRwsz5QB3yUZu0gICd5XTc6TeqzQHGRS0HIfENVAG_LNak-Q682X94vDOpCVGXih5gQa_gYazzt/?imgmax=800&quot; height=&quot;375&quot; style=&quot;background-image: none; border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; title=&quot;image&quot; width=&quot;616&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
5、点击 Change advanced sharing settings…&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiSwnUVPF6TrVHabZ22nITG39sQ94sJh8vOfyTMxNFLYrG5wLwCryEUgrdaS6zyvOzOFw9uwd1bQffJ7oPWlsA__0GsyC1DvBzxx0Svlfc48LGg_EzygON6x_kigY8ZP5nbqCMRUFdkbNYi/s1600-h/image%25255B14%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg_5B1Nbi8x7gsyDCsstAHLW2oi1rKzkszsuRV4RmxGp2AiiZsrboNEgnbiOG-wIWIFxry8byJCxm00wJ7hoBw5ArMwegla1giNYW9gZ5oWOFi1w9fUDjXADw_oYdeG-qqHpFcxcQw6gtgG/?imgmax=800&quot; height=&quot;404&quot; style=&quot;background-image: none; border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; title=&quot;image&quot; width=&quot;548&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
6、选择Home or Work&lt;br /&gt;
&lt;blockquote class=&quot;bq_warning&quot;&gt;
注：也可能是Public&lt;br /&gt;
依情况而定&lt;br /&gt;
笔者连接的WiFi 设置成了Home Network&lt;br /&gt;
所以选择Home&lt;/blockquote&gt;
确保 Public folder sharing 已经开启&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhxTNLXlo6l81a19CPngrd7w8FJpzipEH8_RFI2c2IGYAylliqu1yKoepTtwsJVaApDr5M2pspU2uQHh_exqkt2-DonEIGJeoGLEo4-o_5q80Ybq8RZmDUm3t0SptKxCV7YkuygLl5BGEiM/s1600-h/image%25255B17%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgT0r9Wnzf1GbZmnfECl4UEo2phEI3-79nH19TUc-64bmckaG8i6kzjtuPpiFhyZS981lT8TSunimNe0NiNvsInkiLDNy8yX93PasxpsoPnvg9VtFVXBXIv7MYcNaYfEtZVNDOgT4Mv_lVn/?imgmax=800&quot; height=&quot;534&quot; style=&quot;background-image: none; border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; title=&quot;image&quot; width=&quot;584&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
7、你也可以开启密码设置&lt;br /&gt;
&lt;blockquote&gt;
如果你开启了密码&lt;br /&gt;
那么连接时&lt;br /&gt;
就会有个对话框&lt;br /&gt;
需要你输入user 和 password&lt;br /&gt;
这里的user 就是你电脑login 的username&lt;br /&gt;
password 也是一样&lt;/blockquote&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiF4xGKL6e4ACOl6hDB93vCrrPCpJ_AMDkcaRc_j9nOPp_MXY7zy-UwVKtQNUB2A67h0NkOSp6caKnWa0s2E_NWNO6kA3pm533hWJzYgBWUzYNHWDjPuue8bG8hZOMVJoz2ieOA95g0vEV6/s1600-h/image%25255B20%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj0hPYeKpddKeH5ZpuDCoQMhBFTqEfK1PAQbK4SacLJ1pDfgVeci0pM6-uIDJ7rDzzHFS1v5fhQwmut8sHSkxTWQqhRcZRPhExpLWU5MvqW6FyiVCTV1etZCY03_wF-mjDFtRcP2ZIg5Ktd/?imgmax=800&quot; height=&quot;485&quot; style=&quot;background-image: none; border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; title=&quot;image&quot; width=&quot;578&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
8、就可以点击Save Changes 了&lt;br /&gt;
&lt;br /&gt;
&lt;h1&gt;
【开始Share 文件夹】&lt;/h1&gt;
这里就以共享一个文件夹为例子：&lt;br /&gt;
1、在任何一个文件夹上，右击选择Properties&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgCiyumAbOuK5_yo0oNRlPsIdr4EfpBkw565V8EhNNvbMOByC6dkFwvE28W2zlpQpo7WDxhUIVYsVrYxm4p9mBI1kD16U2WPX_EgyTueAn1rnCAFz35xaM6pLYtH24xcqXftuwc1j1Ta6xW/s1600-h/image%25255B23%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh_v-8zKJ6z-j02kLpkQ7Ku1yCKt-Sg3Bo6p4PUqsvsx6z_1SrlpOGrrzu0kBlPvDebXVnTac3mXXakC6fFGX210BbTuoQ8zotk1sWmpN6BqYQ7YWINPHwU7O4KsSu50qUh_jqVI2Mr5LlL/?imgmax=800&quot; style=&quot;background-image: none; border-width: 0px; display: inline; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; title=&quot;image&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
2、点击Sharing， 点击Share…&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgKWgUm5rKnnd4GTdevqbXEaayWrsCf7Gyyu96279JHjyUOo7lBCzgGCVM0O87rSzr4oXvwgGy7t5YO48YRAU-6ru0BuipsGE_UFQri4XNkx0AxDhMJU-5RMqIl2Sr-Slo9wlkInw0W7Bc6/s1600-h/image%25255B29%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhXXfWw6qAOBNr8xIz40lNXNqIKJW7L1fZzVPgs70ypHAx5lNSX9sD8_ED5iyQefIMaTa3tQ8AOFdcy0xLkQsAyPuT7i9C5PHKotYkllYGLqZd7O0GRDgat5QKyoDaTebWwq9REyvuWrfe3/?imgmax=800&quot; style=&quot;background-image: none; border-width: 0px; display: inline; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; title=&quot;image&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
3、在下拉菜单中选择homegroup&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhHClmXS4CGR6-jfVa5aF1AEi91kLhuuJXJcaI_5mZDa6UMTHU6VdgmaSJP_xUz7h0c1CFBF1KhxGM3olazj6KA5OZDP6tYRW0y5e7zEQkYeyO7aJXE93vLoiOps1ooEz3-CQP2SgmmIkHC/s1600-h/image%25255B32%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjWj6M1xjdcksNNY0TJjfjeqECZBW9ur-0ttr_oLD8D9xSnymBvndY2ModlzQ8w1YW5Yv5k3l_s3qK0fXxSCYyqu8XoX8M6UVuZCoE4X-iSYziF9O-YLvdXzYN0WRrtoErTCY4YT972-sr9/?imgmax=800&quot; height=&quot;451&quot; style=&quot;background-image: none; border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; title=&quot;image&quot; width=&quot;622&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
4、点击Add&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi9kB3o34RSOeMnXu7P6VozyZ-SVraqma386m_evQO8SBBlgW4ZxnxIBGO3c1kh_Iwnhzw3GLXmxyGXCIRdIuQJVnWEcHI5fMkzjJSa6vzK0Kqxf-hyBjtjcMCo_WS6JRN7J_NArTUFKAPr/s1600-h/image%25255B35%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjULGoU-Lg0dOK4A1Z1ibae_1wUObxSJp0rZOOF3rNA-muFm7V3cG1IBTiNqcDJ3mUKSsc29o70bDrr4EBkxgsTRQ208F-m4kbXM32bPc1B7hYLtKH3Bd86pEiukcjLa5UQd5XtJNQMcT9C/?imgmax=800&quot; height=&quot;451&quot; style=&quot;background-image: none; border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; title=&quot;image&quot; width=&quot;622&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
5、在Permission Level 中选择 Read / Write &lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEixzFb2oNDP3oGjD3BMrgkXX-FOvvgEePiTylBwLax_87D42siscqZoLkUbxlFKoqhIP4YRMUDrR2Bf77m_tpAIa5AsMqgxUE7MLlX4Aqmi1nwHautRGvOEgkTS8ECmh-8VzDl1sYqdKlxK/s1600-h/image%25255B38%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiYK3QdC4GEyDDBUizf87VlwnLeATovt_dgglXCMRiY-e0FLQrkT6QxLjd6C2Z4NEupsoj2CYOdIM5-fcYAJsv51QEEAmlSU6YpSws-AHdGjevGTqqerO68BQT3rz48p7MckluzES8h28N2/?imgmax=800&quot; height=&quot;451&quot; style=&quot;background-image: none; border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; title=&quot;image&quot; width=&quot;620&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
6、点击Share&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhiSzB263NiDS_Wj3TuTe8WuchZ8xwyLgT8HvWqqY5DJEM2U9Hlp__dS6BqHPpxMQVZBE7hjlSGNT4i1sYepFkGLXKbL-b4rNukasP8KPcaQm0j5BPP-kBUhwM03Iv7yVNAzUkFLxT1SLVA/s1600-h/image%25255B41%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhOb2tXbQcKB_dqbaBZeJ6t18E1GlQIBD7Lu3Wlk9DEonK6YeqAGn6Cy3iEa__sngnsxOn9JWHcqZyhuie5pORXnHGb0OrctN_A0zkduY9JgZj2jUz_LJKMxIxnE54azhLL0bcdVCbRGyXS/?imgmax=800&quot; height=&quot;451&quot; style=&quot;background-image: none; border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; title=&quot;image&quot; width=&quot;622&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
7、然后就完成了！&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjPU61OjvarCtDwge_S3FKucOTyCCOBUCoNCJFGcgQ-KYrThnS3CR73BOzsk1qoeyM2igVEgW1wY47LViUzr0atpIReu1oY9hi4PETrj52KPiolK5BwPF6AB2nBstRH9nw6v15wcY0RLfQa/s1600-h/image%25255B44%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiMJs1fkC5a-E4_rCP0YSOioslnaHb8w-AAn2X0bubYsA70BOE6SFcfckjOQlNIRfY4VERZbvVYv_VHiyFeMvfhomoyjfvc5dOOQwatAKYNX5u2PkWuDuZnv4CnTGNmiPjL2eI57V-eztOq/?imgmax=800&quot; height=&quot;480&quot; style=&quot;background-image: none; border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; title=&quot;image&quot; width=&quot;371&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
8、然后打开Start Menu&lt;br /&gt;
输入CMD&lt;br /&gt;
按Enter&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh5rl71Zsj22XTeAGFc2QnFaEkmLV0ri7xXcdr_Juiq05e-JFDGjjpRsJWTv8ssSVeBr6hQKK8FFTv3EDhPyg0q5X2JKDNotdi1vQuYwR06ZJos37MmJcMe_KZ-8ilnw3Nfo-Mzcg3VXh34/s1600-h/image%25255B50%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi33aKvFSpNd23cGeG4U5Ld15UUDI9Bs3D7VDq3rbPvtV_6LDSpSfXx_U-ggrCWpzrgGVSNlAtmxhAHqgqFPNZwbdElX87H-Jj11-vE_pbn9mgpg27I8f42TRxQ9SA1houTneLk6KTiQk-g/?imgmax=800&quot; height=&quot;410&quot; style=&quot;background-image: none; border-bottom: 0px; border-left: 0px; border-right: 0px; border-top: 0px; display: inline; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; title=&quot;image&quot; width=&quot;389&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
9、输入ipconfig&lt;br /&gt;
按下Enter&lt;br /&gt;
找到你连接的网络&lt;br /&gt;
这里是Wireless Network Connection&lt;br /&gt;
然后记下IPv4 Address&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjMvp3wPA200_CuVxZdsg4cwscchhMFvUBo9MlmsW0adbDso9QBKCRPprcMSxBNwlCUDIkVanaxeL8Rhuq0VZlLe4xsdHbOmATdbBLFiJNMj1ktGPljrZDDKj6ZBh42vznBY4Nzpx6-2aLF/s1600-h/image%25255B59%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjv_8Hc5ufStEfR70Pm4t2o-QPwS5DdofckzWCm9hqcNnchyphenhyphengMaEQ4i8jK7ZvkM6goFu6kRvopJYuNsYDwXe00nkGbWvCBr8u_Pn6Lv3BV8UqwPEgnE3hoyTusOXAiHChjhgDL2l4sxsyMR/?imgmax=800&quot; style=&quot;background-image: none; border: 0px; display: inline; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; title=&quot;image&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;h1&gt;
【连接共享的文件夹】&lt;/h1&gt;
&lt;blockquote class=&quot;bq_info&quot;&gt;
测试环境：Windows XP&lt;/blockquote&gt;
1、打开My Computer&lt;br /&gt;
2、输入刚刚记下的IP地址&lt;br /&gt;
按下Enter&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhXKNuFb-VtmbvHchtAyw2zdF7KsMCsXYlkdTcyKGqSvVOMVAWAM-hpEzOX9slNvUMeVp4ZpuFnOCKKE2-5_EKkz1dhosJ5CYBwXYbIvw27k-SJEpeyTM3_iE2M09AlOpALFex4O4PzpX9Y/s1600-h/image%25255B62%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgKO8lspnD782tmnP-uv3RG-gWWjz0pZDBcvTIg_07LJRirpDwg38wcAFpYHQ7dSyrb5lW4b3Mhj2VRzDATUq2hG2QTO_nyeNu8LcmSURlTdeizX73o1fu83gearFGML-3HTawhoH9SMLcr/?imgmax=800&quot; style=&quot;background-image: none; border: 0px; display: inline; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; title=&quot;image&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
3、如果你之前有开启密码的话，你就会看到这个对话框&lt;br /&gt;
输入用户名和密码就可以了&lt;br /&gt;
点击OK&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh0fYfIttN4saR4ThCrImskas47NdTjzJfjWebwIYe7yHj_ULqZcbwKWZyOFLbmXP8kb48t7JfqtBC87Xl46IUxkbjwInuwlkDxY-YrM481bIB2-CuqY6C_3QeX6DQmC8TLqB2UHERYsMQH/s1600-h/image%25255B65%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEinAvRePEl9Ca9bFTmUU6vjw2keW9ttuXEUAwGzCgdmSnejtggn_plMZI-0pNlpdEiqH0Wn6AwODWavrSx0NZtInGnLTTCGsanxyYR0kxvfVZ5kZnFAu2kb9CXQIAisz_NeX23TVPx-kU3q/?imgmax=800&quot; style=&quot;background-image: none; border: 0px; display: inline; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; title=&quot;image&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
4、完成！&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjUzDGflpsiuO1c6cCh1cjJcl-KPzbEEdMNUJd6-2QM5vBJlFIH-MXCQeyREC6vD5k6RL5BO-p39FztRiVRcG-RqSOKrGbr7wMIYx1PIsS1hgwjiDPjv9Hv55-fLQdwCjXnaQN7L4kWhOUh/s1600-h/image%25255B68%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiZujhzXub6CcWm8pfBIy7vR6A8yDvMtmxMdaDTW_j9ZqTxgfSDnh9Ngc7UCiMqzIfyfPcTNa5JFsVR5Dfyq7UOo_2sGIOggkS85g0LoOL4QGAXyJ0OG7ET-6Rt0CFxI88rEvb6EdmP-DOQ/?imgmax=800&quot; style=&quot;background-image: none; border: 0px; display: inline; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; title=&quot;image&quot; /&gt;&lt;/a&gt;&lt;div class=&quot;blogger-post-footer&quot;&gt;&lt;script&gt;
SyntaxHighlighter.highlight();
var linkwithin_site_id = 1130633;
$(&#39;#toTop&#39;).remove();
$(&#39;body&#39;).append(&#39;&lt;div id=&quot;toTop&quot; onclick=&quot;$(\&#39;html,body\&#39;).stop().animate({\&#39;scrollTop\&#39;: 0})&quot;&gt;Top&lt;/div&gt;&#39;);
$(window).on(&#39;scroll&#39;,function(){
if ($(this).scrollTop())
{
$(&#39;#toTop&#39;).fadeIn(&#39;fast&#39;);
}
else
{
$(&#39;#toTop&#39;).fadeOut(&#39;fast&#39;);
}
});
&lt;/script&gt;
&lt;script src=&quot;http://www.linkwithin.com/widget.js&quot;&gt;&lt;/script&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://garyngzhongbo.blogspot.com/feeds/4460471507088826679/comments/default' title='博文评论'/><link rel='replies' type='text/html' href='http://garyngzhongbo.blogspot.com/2014/03/windows-7.html#comment-form' title='1 条评论'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5319618319979683940/posts/default/4460471507088826679'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5319618319979683940/posts/default/4460471507088826679'/><link rel='alternate' type='text/html' href='http://garyngzhongbo.blogspot.com/2014/03/windows-7.html' title='[教程] 在Windows 7 下共享文件/文件夹'/><author><name>Gary Ng</name><uri>http://www.blogger.com/profile/00014057672539539340</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgzH0-g1-bC9HIUtJOSVdDKPsGok6lE5R1wwRYeDd04dzb92Mnf8TyRzuwkbZFK7unPQnhMktpCcLm2G3gJ33VA0PBo4OHU0uW80BOg_OUMu8C_W5-y7kDMqp3Het81kQ5rlpjoGe-WDz43/s72-c?imgmax=800" height="72" width="72"/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5319618319979683940.post-4041120828426166667</id><published>2014-02-14T01:08:00.000+08:00</published><updated>2014-02-14T01:08:47.931+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="C#"/><category scheme="http://www.blogger.com/atom/ns#" term="入门"/><category scheme="http://www.blogger.com/atom/ns#" term="原创"/><category scheme="http://www.blogger.com/atom/ns#" term="教程"/><category scheme="http://www.blogger.com/atom/ns#" term="新手"/><title type='text'>[教程][C#] 新手入门教程#21——Namespace 和 Class</title><content type='html'>namespace 是什么？&lt;br /&gt;
它能很有层次的管理全部代码的结构&lt;br /&gt;
你可以用namespace 将各种各样的 class 分类&lt;br /&gt;
让你很直观的了解每一个class 中method、properties 的功用&lt;br /&gt;
&lt;br /&gt;
你：namespace 用在哪里的啊？&lt;br /&gt;
其实namespace 和 class 一直在你左右！&lt;br /&gt;
每当你创建一个新的 project 的时候：&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhwx0-GV8nszbNJ2NCgUSdADN9zNV9jlQ7TtVYI7tEdOg_K3F_FV9t6caONLKB40a-Knw8b8KXMYXwfZQGb5DKmHgHRJzUkB_p9StAxT8qZRn2BzMOi_mWkREWqf7wpB-Pqvkgj_kUP7jB2/s1600-h/image2.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgIxEnn92ZgmjL3Www2fU3byQSxJdhnupylIFjSr6rcUi-6NiCBLHFEQdDYWrDCh1M8bjGoSWEFeJe6OhUCkjlsEwbq5VuUx2Oky651S3dEGovQquMHIpbKt8m1CLrnM7KJX2QGrBdwhjn8/?imgmax=800&quot; height=&quot;443&quot; style=&quot;border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;488&quot; /&gt;&lt;/a&gt; &lt;br /&gt;
&lt;blockquote&gt;
最上方的using 就是引用特定的namespace&lt;/blockquote&gt;
&lt;blockquote&gt;
而namespace WindowsFormsApplication1&lt;br /&gt;
就是创建一个namespace了！&lt;/blockquote&gt;
你：哪里都可以创建很多个namespace？&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjmdhdVGSo6XsAkmedBt0ianPQzPlqI178yk8RBiEabCIN7PqZtgzkyCM-toUrYVUaXXh9pQHrFwsUsAAZSu1SZikRM8uFJL_aGl0eNxf-Fn6azG9be3OaIvHQ6Bft4byWGL4LgmP-MWIgq/s1600-h/image5.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh2G1LvlpOxhHFPvxKYPLkQBZfD1J4HTUSHkdJMkOk7JssSVVvUjC62ORnO71_L7QAQ3YTUkYrZ1hWcW6PzDt8on4IHVvZAIaxos9-g9RxbUSrHe1kirleiNkUMYsO3TGevTEpRuQD6rgI7/?imgmax=800&quot; height=&quot;499&quot; style=&quot;border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;375&quot; /&gt;&lt;/a&gt; &lt;br /&gt;
几乎哪里都可以&lt;br /&gt;
你可以在namespace 里面&lt;br /&gt;
也可以在外面&lt;br /&gt;
&lt;br /&gt;
但是你不可以在class 内定义namespace&lt;br /&gt;
&lt;br /&gt;
你：class 又在哪里？&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEilhyphenhyphenjSmMZHzTxy3_HfUnnVJBdxcXsuCh5msvYFYSmfyo_UWq7BDEfl2TQXkHj6PXN_hH11oVFkjswX2Ftazock4pxq6SFukrh6oXwTvhaJ_DxQMx66l-VPPAJphm1y_1FEVAVtv17deOW6/s1600-h/image8.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjUSL2jUJQIel9JfreXd2Wj-_a4wYoVj6SvIfmbfhDmaUfBjsENl5zl7pB2qF4cqa-ipkJDL_zmZ6BsFfobyxvcM-9923fOR5tpIsmfGXYch2Zg0NTXQ4Dk3Nf3cH3RArMmutkNwFlEVhxH/?imgmax=800&quot; height=&quot;345&quot; style=&quot;border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;376&quot; /&gt;&lt;/a&gt; &lt;br /&gt;
&lt;br /&gt;
class 可以定义在一个namespace 里面&lt;br /&gt;
也可以嵌在另一个class 里面&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj99MjFdPX93hWbrEzvj84Rsb8Em6KpSgGFaGqvgROrPLTzRgOUygEM2yBgESDssMUGvlIiD5vPXjiwg30Ip-3uWTg4TBNZ0iLgfzUCAfA6d-hfYRO4-cbwJQd7tsskEJfsJIRp5LhThOce/s1600-h/image11.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjuS9TqKfkfJdim1X52b_q5aFqf4X_hAjOArYY1lk1z25uQX1o6WElZ2ga5ogQ7i1D7TAsif6B74DzXaF7E3-QWfyQCercJNMP-N5uRZjQJpOyx7kuy7phgMx9wAmX22vtHwxigN6leWa4p/?imgmax=800&quot; height=&quot;530&quot; style=&quot;border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;479&quot; /&gt;&lt;/a&gt; &lt;br /&gt;
&lt;br /&gt;
你：如何创建一个class？&lt;br /&gt;
你有两种方法：&lt;br /&gt;
&lt;blockquote&gt;
1、就是在同一个文件内&lt;br /&gt;
然后有不同的class&lt;br /&gt;
2、在不同的文件内&lt;br /&gt;
有不同的class&lt;br /&gt;
或namespace&lt;/blockquote&gt;
方法2：&lt;br /&gt;
首先要添加一个新的文件：&lt;br /&gt;
先右击你的solution&lt;br /&gt;
然后选择Add&lt;br /&gt;
再选择New Item&lt;br /&gt;
&lt;blockquote&gt;
或者你可以直接按下Ctrl + Shift + A&lt;/blockquote&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj-eIPU4e017ckCKYyg2bummXmXzv-oYLYjy-MJ6Pk2U5UcoDF3HU4rU0iBS5gZdTlCZ35pRZYV1EbepwFolbd1PCMoYvqUklacYoG-zO0Z9NS78knaWWAcEm7WHDLTNE28o-pO1c9e_euT/s1600-h/image14.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgLTnakStizxYfif7QRfp78DmZBDjqcxXi-T90PfZq95n93KCnYVJQaOMf5jwqM-LE5Rmm0hfWaP8_U61CVc79Yr6VvZyhPRxrrN7DP8qcCE4Axu_DX-Ja9V4F-ySDe2zB6GAImvdlODu-D/?imgmax=800&quot; height=&quot;541&quot; style=&quot;border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;767&quot; /&gt;&lt;/a&gt; &lt;br /&gt;
&lt;br /&gt;
选择class&lt;br /&gt;
然后为你的class 取个名字&lt;br /&gt;
&lt;blockquote class=&quot;bq_info&quot;&gt;
尽量取一个一看就知道这个class的功能的名字&lt;br /&gt;
&lt;blockquote class=&quot;bq_warning&quot;&gt;
千万不要放 Class1 Class2等等！&lt;/blockquote&gt;
&lt;/blockquote&gt;
&amp;nbsp;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhYUt3v-WdkjabBVSyyzRLFS0g0BE_sGz1sIE4yPBouwBo7gMSYpTqOVs-LOnYEeEXR_Njx-OR5sOCeTiFh9d4que3Rr1AvEgYocYK0_10vsgX1m1cX4SP95IIUt15e5MhbQPrYA-OU9dhD/s1600-h/image17.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjXZhz4nnRGF6gBe3c7z5LLMXuZudwp3cNzdF0jh0t4d7F8H2ZR5wEZ8o6E6AtVX3fHinLJmr3W4EbSlmW4NSydejrIODB44diWMIJc9BD3c5GUSV6VUOoDI1dxtXutIIyuspV4bGwcM9je/?imgmax=800&quot; height=&quot;616&quot; style=&quot;border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;955&quot; /&gt;&lt;/a&gt; &lt;br /&gt;
然后你就有一个自己的class了！&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhcByv4iX1T9Yuv8vMslOZ57TnRQtN_V6dWXy1NKuAyDlgFoaMWIShmSBCcNlfcVlvIiBKgL0wWrZqhye96EiX3K8c6bbhFoz_8wRpgemkEUSdlOU1d3wRPU03VkOZZ3SZYHK2R8umOLplJ/s1600-h/image20.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjQ3E8HxdH2Xo8HOdxksxzIK2_2yECeODL3Cqvm2ubcGtP_6TCYxahr2zdjPe7qRMIsLu0AfjJIRZBjl92Mr-iMuht1yzpjEC7OPGXunf1dILqFM4Nrp9yqpDGmC3IPIdxkYC67yO6Iwzj-/?imgmax=800&quot; height=&quot;488&quot; style=&quot;border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;688&quot; /&gt;&lt;/a&gt; &lt;br /&gt;
&lt;blockquote&gt;
在这里，namespace 默认是跟整个project 的 namespace 一样的&lt;/blockquote&gt;
你：如何使用一个namespace 里面的class&lt;br /&gt;
如果现在的namespace跟目标namespace 一样的话&lt;br /&gt;
就代表可以直接使用MyClass&lt;br /&gt;
直接输入MyClass：&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiZFeFdOQcYCj-AfREUB6qAOMY_ujp84Py6Q0vDcjLpzU_4IThHBDl_tQvIDJllWdQLqfcGTohvz-YWka-QKHrRSQEgcEs4n4JcO_DcdYPCJAUSltl-JBfDZlLaDUA38ZcB_GCkKhhScaoV/s1600-h/image23.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhqHBWHVoEsjCQ1OkbPJ-mGaIe1W09_gzN8fJRlpQRYovROAEdv4yLUSLJNHxSHLNWEUja3UPicNK2bya5W3MRWw9oCg3QJbFG1M7sXkxdpDvohDnNvAUKxurJnXbhUDW06XtRFUQBIDLGF/?imgmax=800&quot; height=&quot;406&quot; style=&quot;border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;710&quot; /&gt;&lt;/a&gt; &lt;br /&gt;
你就可以直接使用MyClass里面的函数了！&lt;br /&gt;
如果namespace 不同的话：&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhSf121VgQkuhOMNX4vmjzK7LNYIKhVISYdgIIvXbsPjda3cUWhJIAcjbuTSbWPZJ3lOkO2BIE_d7-TOAE2PITKNydRFGQWmZEyiBcmMXNNYEU5r30ucVN2jEmtktj19gcy2n7w5YLQ_PdH/s1600-h/image26.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiKO5mbu4ncj502hBItEcmsEgJvX0h-JMtzXLzb-mZLlbu6d-tgYTvNV2Q9lZgk3LiarVgruQy8pnFU9Vivzft8UvJUTihMWG0i7OxrXIzY6-spN5tKdhyphenhyphenGHwWAyMCdb4zfulLBiDiAHojQ/?imgmax=800&quot; height=&quot;331&quot; style=&quot;border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;372&quot; /&gt;&lt;/a&gt; &lt;br /&gt;
当你要用到MyClass 的时候：&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiaeLIQB8qbi4l4Czun2gXQWMpkkaChj4uzVXOJdIuF6pTFkekUo_Ty_EV7XL3cExMWfWRdfW7cGpCPC0TJqSjnTDcEL3ph4CvGs27IDzVTzAH26_oJO0VUboNpK4jPzrMG9jG087t8iKvx/s1600-h/image38.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhQvqNEAhDRH6-1S95fO_GdXMC3H4tJKFUZ0CbM4ee_FXN2q5X6BsH0KAZMC4mJRb8Zgl-Y77kIljMVr64K82LHQjJaRmyaWgHbzAE1vVDLYYWWihHbTFOz549GjENhTgxUH0rDBXJ_wGvG/?imgmax=800&quot; height=&quot;371&quot; style=&quot;border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;483&quot; /&gt;&lt;/a&gt; &lt;br /&gt;
你会发现到VS画了波浪线给你&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg04vf_T7FjIYQNvGBRjFu9kNn8iCgLa1B_PvHDBh4H8A84a3-h3OK0RakkQ9ng5lKYgZKRMVRypc5cbid5CDuI9eDRexD9KUapPMQij8DpilvpLpzyeYqnkb3sBc7L1D8Ht-legggGbS65/s1600-h/image41.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjeys-McHiDWMxgvR1xOoIrKlPm-W2S8JHgWP918hEtqcU0mr6YKd2jN6jhn5X_Q6ngetB50U0E2usy7Rrc8rtIduQshpW2q56KT54UMR8kAbkQlHxsTx-hK2MxVPduVjgQSbiHFWLmpYUe/?imgmax=800&quot; height=&quot;206&quot; style=&quot;border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;719&quot; /&gt;&lt;/a&gt; &lt;br /&gt;
这个时候就需要用到using 了&lt;br /&gt;
输入using 然后跟着 namespace 的名称：&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjnHxYqh1FLwUYb9gzb-ADftbPmAvc4RLlE12cXkHAqh_uY7oEe9GTvp0MLdxZ-5xRKMYCkRgB73_qARoQ3_aMauUSpOLwFUwxhahDb_aQEtrTt9wYXJj9IrqSNZtTQuiWbTGs3C3Roi3pl/s1600-h/image29.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgYk5TFBIm3LIbKa4aBsz5IgyE-DZF7JbZD4ctX7QZ9uqLZ84PhSEJ-MGyL8WOVJFK_8Mg8fsfU78fkqcRVgpl8L-BFQr5v8woyByR2NoLDy1hEVLkA8aBijDXvCbX20L11Z1_vv5FhjTxH/?imgmax=800&quot; height=&quot;397&quot; style=&quot;border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;479&quot; /&gt;&lt;/a&gt; &lt;br /&gt;
然后在加上一个;&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj5z2M36jmED5eKLJeZtQY_2lws-WajHjvLb4z68ikld8STaYnYS7BLEPzlnhMaLGl9hyqDJXWGzW9FGMe7_nD26NifKDEAirputT1UbbyVScUEr7fBrRUdn1tSILBw1uuCGFYaMk5SiUYn/s1600-h/image32.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgBft9Y6FGWUjzjkOC172AsGCvpftxEyz_10Da7LuaxlRAB45-RTIKt0i_vpgVN9HzS17feZN0I3leKUQJbMCQpLunTfdC4a35WDl_1OIRrfVls4pF5bBqAvDnnaSs4WoMOohsOeyGH1-d7/?imgmax=800&quot; height=&quot;397&quot; style=&quot;border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;479&quot; /&gt;&lt;/a&gt; &lt;br /&gt;
就完成namespace 的引用了：&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEijDTtfdmYCoPMEK8h7uMXCFczi0D6uQBeefZWzEinVrliw0dS8nFO_-G39hHGOzuirzY9PCgSu77M5MWakqz0GMRfW9u2kyR7odBOFMMKdx1jRAfJUzL8KRvSkWCds9YAmYPvRQX7sHkfo/s1600-h/image35.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjnjhR6LJLA3RO5CDT4DrCU3tvblXw5xLXYWe0bnqrHZMglfuep1nWW9p-bIgcHLEV03ySajE4k0Hwl0QHHN5A3mscAWwEnnCZdpdmcPa_oG2n9fXZIb8Gf_CpmzCyc9mN3crirPUDsBXTt/?imgmax=800&quot; height=&quot;418&quot; style=&quot;border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;612&quot; /&gt;&lt;/a&gt; &lt;br /&gt;
你也可以直接用：&lt;br /&gt;
&lt;blockquote&gt;
namespace.class的表示发来引用一个class&lt;/blockquote&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiRXaMCiMYbPENqFJ2Qb8Y4EvD2aaWjcKskJ-1nnGUML0uwgKSOJSceQFm6fpw1D7u9TKflBBxG7xRZT4VnGpJIP7ngVaTUVHVNzR6vt7VjsOwYhDewf12nZApJ1o8hhDfND75YgIeccsUf/s1600-h/image44.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEheDkjTDSfZdE26k2Ut6tOpeNku3Y5IAdnw1wPHw-QzIqLafYLxQheG3qGpY3mWjwu7VKmPflirmqd_ODMGOnrLSD3C9UYRE-vRdI2djcDOAMq9Rwk_S7j4iMIw_JcztKbCzkZ59q40L-V6/?imgmax=800&quot; height=&quot;233&quot; style=&quot;border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;461&quot; /&gt;&lt;/a&gt; &lt;br /&gt;
&lt;br /&gt;
using 的用法还有一个&lt;br /&gt;
&lt;blockquote&gt;
就是为一个namespace 取一个别名&lt;/blockquote&gt;
比如说你有一个名字很长很长的namespace：&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhVMcWjBSbozm9DXX2QqgdZz-Y5zD9uMnqLlFFrZyRxKEAvL3_w8HbaqG9LATdNa_hDER22qX1KHQtLQZlnSCCZw1SlXmcFVR0KPJ1dPtBF05IavKV9v-PeOlWkD47LE488sufcmepLskXx/s1600-h/image47.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgksj7eanSAa6wEyaayKgHWR48WHsjvZ2PizPzPkvagdgpXeSDwq9Ux5A5XyviI9vvnW3Y4ooEeC8-diBpdWNZnMWPi918dHKbokepsLofXqp4_u_-8hnizS9EqTkDMM12jOLS6hd_dpPdi/?imgmax=800&quot; height=&quot;254&quot; style=&quot;border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;695&quot; /&gt;&lt;/a&gt; &lt;br /&gt;
然后你可以这样：&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi0WUETkLnSuaC3dcDDoPNGqoQ6El5ZO14YLOviC8hyphenhyphenTKS-4Dszr8OYz5ukojRMmozWvxIubsg1eJmlP28Jg-OxmfPjS1tD_K4KWCb7w9EEU3P6X0cFlQHNXA-mHG4O0Tp9lk4tK34cKCLX/s1600-h/image50.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjgDA35b6TC0RdgWOwbnX9-YmM9tleXpbNCpN6E9hwSRLbcg0ibUsVn1ThNLgYwIZS-08AFPUsqZYADHmFByF5HfxyuijNxzESr8kbbsPG7RMkjA2z57V1Y0uIlRbsfVkKvqlBXNUEqxlLe/?imgmax=800&quot; height=&quot;388&quot; style=&quot;border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;718&quot; /&gt;&lt;/a&gt; &lt;br /&gt;
格式很简单&lt;br /&gt;
&lt;blockquote&gt;
using &amp;lt;别名&amp;gt; = &amp;lt;namespace名&amp;gt;;&lt;/blockquote&gt;
然后就可以直接：&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh5xmayTAOiJrrVIJP3qqLjR4skWHIp3_og3zdZPsvW_pr-l3MASA9hnObKYf7Qrks9NM1Qf8gwEb_3Pk47wu8cQo45Ylg9uciE3jawGwfL5-l3cMgfw-vdV8cU2xXJ9tENzH-MT94RUStK/s1600-h/image53.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj_4u5k2PXhP9e8P_4croKOfqxXswTAd1021jVLWyrvzARABdyIonOgSBzgjv32Ac5zpGyMMaaw8is3lwyx_RLuofgXANOdsehyphenhyphenJgPwptThSc0eS6OQ9b4bhf_9JG-ZuQNt_SOg2BVrj46V/?imgmax=800&quot; height=&quot;395&quot; style=&quot;border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;786&quot; /&gt;&lt;/a&gt; &lt;br /&gt;
&lt;br /&gt;
如果是嵌套的namespace的话：&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg_gQzLWT6-MQwFNCcbUUYLDLnTv50yancZR8y_fpJD2KGdY1tKaMHM5MGQ7dU6gQoXLbeKW1F82k7LJogO1bCK4YMkQlqIRevo9mC5ugQaC2_gTZIsDmqJR6nkqjkrmeysHgEgTMEvuPMj/s1600-h/image56.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgwc6oOkdCSVICVWgt4dZJ2TaIvYJK8nHs2FyO7m2ZFWzYBZnYaRugEuC4qwsRwjjBCXsuTSW8YoBbCH5aMhVnconGasROUMhUoWC16hQRgk7REfOlQgNs-Li88qsM_JMIypj0xuGNlTgoP/?imgmax=800&quot; height=&quot;355&quot; style=&quot;border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;322&quot; /&gt;&lt;/a&gt; &lt;br /&gt;
using 的写法如下：&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjhyphenhyphen3PAk02YZMVbh6V_dgrVCSe68gLjh5vob0vX5FNf0GaJJVYFjO0E91ya3EkLRt-MqKuHbLdLAMwqYQP1UmHf7QnuGhwz9Xz91sLmsUvAKNxmdqYP6TovMsY4cyWRZwS_4PrnnUr_GXEt/s1600-h/image59.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh4oFOpw3raYe0dhY9k1-p6beKjLDHiPVfaIx8UeugTGL5len_VL3Jl6WNOc3Cd-dRoUWGnxMF_775SgBqIj8bkAJVvKWeosBFnDdhgSCHIv5LFnu_Lq2zPcc9Px7-iaES2uuWPn3OI8p92/?imgmax=800&quot; height=&quot;392&quot; style=&quot;border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;488&quot; /&gt;&lt;/a&gt; &lt;br /&gt;
简单吧？&lt;br /&gt;
&lt;blockquote&gt;
using &amp;lt;namespace&amp;gt;.&amp;lt;sub namespace&amp;gt;. …&lt;/blockquote&gt;
&lt;div class=&quot;blogger-post-footer&quot;&gt;&lt;script&gt;
SyntaxHighlighter.highlight();
var linkwithin_site_id = 1130633;
$(&#39;#toTop&#39;).remove();
$(&#39;body&#39;).append(&#39;&lt;div id=&quot;toTop&quot; onclick=&quot;$(\&#39;html,body\&#39;).stop().animate({\&#39;scrollTop\&#39;: 0})&quot;&gt;Top&lt;/div&gt;&#39;);
$(window).on(&#39;scroll&#39;,function(){
if ($(this).scrollTop())
{
$(&#39;#toTop&#39;).fadeIn(&#39;fast&#39;);
}
else
{
$(&#39;#toTop&#39;).fadeOut(&#39;fast&#39;);
}
});
&lt;/script&gt;
&lt;script src=&quot;http://www.linkwithin.com/widget.js&quot;&gt;&lt;/script&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://garyngzhongbo.blogspot.com/feeds/4041120828426166667/comments/default' title='博文评论'/><link rel='replies' type='text/html' href='http://garyngzhongbo.blogspot.com/2014/02/c-21namespace-class.html#comment-form' title='0 条评论'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5319618319979683940/posts/default/4041120828426166667'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5319618319979683940/posts/default/4041120828426166667'/><link rel='alternate' type='text/html' href='http://garyngzhongbo.blogspot.com/2014/02/c-21namespace-class.html' title='[教程][C#] 新手入门教程#21——Namespace 和 Class'/><author><name>Gary Ng</name><uri>http://www.blogger.com/profile/00014057672539539340</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgIxEnn92ZgmjL3Www2fU3byQSxJdhnupylIFjSr6rcUi-6NiCBLHFEQdDYWrDCh1M8bjGoSWEFeJe6OhUCkjlsEwbq5VuUx2Oky651S3dEGovQquMHIpbKt8m1CLrnM7KJX2QGrBdwhjn8/s72-c?imgmax=800" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5319618319979683940.post-6618389457256063449</id><published>2013-12-20T11:48:00.000+08:00</published><updated>2013-12-20T11:48:06.176+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="C#"/><category scheme="http://www.blogger.com/atom/ns#" term="入门"/><category scheme="http://www.blogger.com/atom/ns#" term="原创"/><category scheme="http://www.blogger.com/atom/ns#" term="教程"/><category scheme="http://www.blogger.com/atom/ns#" term="新手"/><title type='text'>[教程][C#] 新手入门教程#20——Continue</title><content type='html'>Continue 和 break 有着很相同的地方&lt;br /&gt;
但是break 是退出整个循环/switch &lt;br /&gt;
而&lt;br /&gt;
&lt;blockquote&gt;
Continue 只是退出&lt;strong&gt;当前&lt;/strong&gt;循环&lt;/blockquote&gt;
就是说&lt;br /&gt;
循环还在继续着&lt;br /&gt;
但是当前循环会被skip 掉&lt;br /&gt;
continue 之后的代码不会被执行&lt;br /&gt;
然后整个循环语句结束一次循环&lt;br /&gt;
进入下一次的循环&lt;br /&gt;
一个典型的例子&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhgNAC3iaghwf7pS8zcddMe4-w2L5_8crcQC1ZbNJ2DPruUJOirX-4r8xsYO83-1UyFMoIauzMPaMnHTvEIolpdN3lKxym7n3hs1e72RMaKMOjE4jaAJ50ywo2iigVkw2pD1BDI7sRu1Gmx/s1600-h/image%25255B2%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgMn0HDKXk8Mui_rGMwKQ6UAV9aiLhrBefhz6938xYCggSY2J2EA3XjqaQV_6j9Ad1uj1Lm6aiw0l3SMQ-0eZI-tfzWTvj3Q8i1lvlOt2E8-MQvjQ1_2ZkXwmOlxKkHRwcaCWmaJp-RoNwZ/?imgmax=800&quot; height=&quot;127&quot; style=&quot;border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;443&quot; /&gt;&lt;/a&gt; &lt;br /&gt;
输出结果：&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh4HNUIQWFT3rdcyNBPFPn1UexBZYgnF15JJ-YUfI9oe71SQ4t2pfJx7zi2SrvEnl5_fYmuD0wlhBoZx76f_IKcBkK54LyDl7J5qNBJMeJR-LQfZqm8mkIhuSzIX0C7V9VjOyXCVnJZrNYR/s1600-h/image%25255B5%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj8n9vlhfq5H-XiTJWWVm2_rHeN_VHC3V2Z6HtiY3VuVYPtNr93cRpHGTf1WX0JCWSolm4RtLoFZlp-27ETe1HwgtVD7nBaEuHtJG4SaRSvUtI997dSmEsR9ofxf-EpJtVHwy1o9rBgFrHG/?imgmax=800&quot; height=&quot;300&quot; style=&quot;border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;300&quot; /&gt;&lt;/a&gt; &lt;br /&gt;
&lt;br /&gt;
如果你的需求是这样：&lt;br /&gt;
&lt;blockquote&gt;
当i 等于 5 的时候&lt;br /&gt;
&lt;strong&gt;不&lt;/strong&gt;将它们输出到textbox 之中&lt;/blockquote&gt;
显然 break 语句做不到这一点&lt;br /&gt;
因为我们好需要整个for 循环从0开始一直到9&lt;br /&gt;
&lt;br /&gt;
但是continue 能！&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhFJz3o8R1aDDQDOsiT4qFgnMkP0oRkSloFGT-hmED71-puZUrovg22EcEN76RaFfHnDVP_CORabTbYGGQbEFXsmQfOTOlQ9lEqOAkwPpqD9YNNo8rxPH41oo70wqKSbzMItFnVTJR_0Cpd/s1600-h/image%25255B8%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi-XnIGe4ZTm7VJwF_m2tv9AswbTS8Q1s2Q2zKW4SKIJ5MrxOVHFxx_NfPvx2zugCnbpEdm61s8kQQO_cjGWbmLunujJL_PBEHABVhMhGVhB7IfigL88HFF4A1FoA_HQ1Kc9f5dLLPBbAZW/?imgmax=800&quot; height=&quot;183&quot; style=&quot;border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;405&quot; /&gt;&lt;/a&gt; &lt;br /&gt;
输出结果：&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEixBtEWmj-C36jcEIheEM4Bvw-GFhRJQ-4clVhrQF9K4JRarGwJRCdVUnY3Zl7iQRXZioedZv5CgrMYJAqYrrRKv8eb_drqDE3HaweIpfdViKfY4ZW-oG-uJNbB92YMv4SMXWlrtx2WXZ_z/s1600-h/image%25255B11%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhbVFy0vXve7zvM7Mts9PyiQHzoFWKLoT6z_MRPZs7eQOqSYuehLoPC_-MPFdYjKA8r8sJMUBQuOrl6oYBHhbmFNMN5jyNW1lhA7sjSjLkbnwPEMI8-tm69g8I8y4DgIKj-1Xp37B9QZWBq/?imgmax=800&quot; height=&quot;300&quot; style=&quot;border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;300&quot; /&gt;&lt;/a&gt; &lt;br /&gt;
&lt;blockquote&gt;
当i 等于 5 的时候&lt;br /&gt;
if 条件成立&lt;br /&gt;
continue 语句被执行&lt;br /&gt;
当前的for 循环结束&lt;br /&gt;
然后执行i++&lt;br /&gt;
继续下一个循环&lt;br /&gt;
&lt;br /&gt;
&lt;blockquote class=&quot;bq_warning&quot;&gt;
注意：在这里 textbox1.text 整句代码（也就是全部continue 之后的代码）都没有被执行到 &lt;br /&gt;
但是，for 循环却没有结束&lt;/blockquote&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEivAqAALotpTVI1ImLqswt-i-Dm2YqjGE88Fy4iykmBKietD3B5aZI02TCEEuMQ_8CCvMD7_mmOicrb_wLvT9WPhuTiOKOlRSICyqrSfhXIdvxclHRcoIse9JYnr9OPI15GH-SVMkLLUrwM/s1600-h/image%25255B14%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjw0p2akau25rk-BUivBwKkqoMDJB7TeLieuMsAHcYmmT39zlpLA1S3E1phyc6ptmB37sMYmf4ubTXIB9VWKTcUO2IPzJufdd8pMhaSHMW9V_0VKyhHoj6yFRDNuuNp4FbYoxLZsT-V37WT/?imgmax=800&quot; height=&quot;260&quot; style=&quot;border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;431&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;/blockquote&gt;
&lt;div class=&quot;blogger-post-footer&quot;&gt;&lt;script&gt;
SyntaxHighlighter.highlight();
var linkwithin_site_id = 1130633;
$(&#39;#toTop&#39;).remove();
$(&#39;body&#39;).append(&#39;&lt;div id=&quot;toTop&quot; onclick=&quot;$(\&#39;html,body\&#39;).stop().animate({\&#39;scrollTop\&#39;: 0})&quot;&gt;Top&lt;/div&gt;&#39;);
$(window).on(&#39;scroll&#39;,function(){
if ($(this).scrollTop())
{
$(&#39;#toTop&#39;).fadeIn(&#39;fast&#39;);
}
else
{
$(&#39;#toTop&#39;).fadeOut(&#39;fast&#39;);
}
});
&lt;/script&gt;
&lt;script src=&quot;http://www.linkwithin.com/widget.js&quot;&gt;&lt;/script&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://garyngzhongbo.blogspot.com/feeds/6618389457256063449/comments/default' title='博文评论'/><link rel='replies' type='text/html' href='http://garyngzhongbo.blogspot.com/2013/12/c-20continue.html#comment-form' title='0 条评论'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5319618319979683940/posts/default/6618389457256063449'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5319618319979683940/posts/default/6618389457256063449'/><link rel='alternate' type='text/html' href='http://garyngzhongbo.blogspot.com/2013/12/c-20continue.html' title='[教程][C#] 新手入门教程#20——Continue'/><author><name>Gary Ng</name><uri>http://www.blogger.com/profile/00014057672539539340</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgMn0HDKXk8Mui_rGMwKQ6UAV9aiLhrBefhz6938xYCggSY2J2EA3XjqaQV_6j9Ad1uj1Lm6aiw0l3SMQ-0eZI-tfzWTvj3Q8i1lvlOt2E8-MQvjQ1_2ZkXwmOlxKkHRwcaCWmaJp-RoNwZ/s72-c?imgmax=800" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5319618319979683940.post-6328552242317449154</id><published>2013-12-16T14:09:00.000+08:00</published><updated>2013-12-16T14:09:46.664+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="C#"/><category scheme="http://www.blogger.com/atom/ns#" term="入门"/><category scheme="http://www.blogger.com/atom/ns#" term="原创"/><category scheme="http://www.blogger.com/atom/ns#" term="教程"/><category scheme="http://www.blogger.com/atom/ns#" term="新手"/><title type='text'>[教程][C#] 新手入门教程#19——Break</title><content type='html'>记得break 么？&lt;br /&gt;
我们在for 循环时说过&lt;br /&gt;
现在来细细看下&lt;br /&gt;
&lt;blockquote&gt;
break &lt;br /&gt;
就是直接跳出整个loop (for, while,switch等等都适用)&lt;br /&gt;
不再继续循环&lt;/blockquote&gt;
例子：&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjsJy8a8WsZMkigCF7pxKYKjrsrodZmzanDhzPVeg6cy2tyX-4iobrr-EPzpHmZAyRAYsbC7MlDdRdMkQVxfFnMgDpnHyX0VqZqkq5hqcmufIojY7JUctM8PNmxBs1vYayxK9aXhT25jbMH/s1600-h/image%25255B2%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgXMDZn-tBPbnmHMncRIOPSCRpPl4UPjK45y0DqWYQoC9ejFedUkyPeJlLFWSxKxZtsPNaZcnwZE-gLwi4Hlg_JOe9r3YKbt21up6A4rkbTHzzOstYEdf0MiIxv_y3UqCKzG6tQVF66uGt8/?imgmax=800&quot; height=&quot;122&quot; style=&quot;border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;401&quot; /&gt;&lt;/a&gt; &lt;br /&gt;
结果是很容易预测的：&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi_fJZVQBTJidXU66zDVJSXut0qd3YWmoZuPJAvOj4DjHZ6NSoS_Afkx65Ch4ORIKwZU5i_r_3LeofhRVNNc5FQTFBKQnyR0_GrPYOZEPX1DGfL5Xt2vlCtTAIcabWMlPdKOQTFkyTpbvHI/s1600-h/image%25255B5%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjxGimWnFNJLftmu8q0rxndrpfTKRVTgHzmpto8oms22voqaoF8odh2zfJDmGL2R91Msus2cBYe_0CdLLfYGhtwD3dMGmXWYVVxDIJMjJEm7pXQtaniZ3gb5V0IvrCWXrAmCQGp6KyD9XX6/?imgmax=800&quot; height=&quot;302&quot; style=&quot;border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;300&quot; /&gt;&lt;/a&gt; &lt;br /&gt;
&lt;br /&gt;
而break 呢：&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgRQzrS6VYCzyLbkKa_5Ls_JKSYGUpWvq_-7bODRj-SYZysjDwLrWnopD5xn6qx1vYHAwNiZMEX-bZRQQNr1Q4EIkEkFi62s0YTx8Ht84_pLK9e2BNTYb6CllTtdyH21n8_kNKaRRNUN7hT/s1600-h/image%25255B8%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjX4IoFkg8ntJXfmD3XGhJAEBH7pu323w5ZbkpXo3BJG2AX2rcE9koV0-l3kvCJrMvSrfKI9cX9tMtEu3VHW-m0dGbSPvCcHVToiobdhbgXlXg2FC2GOc1YLvS06ql2XVEQNZTe7_7_ius0/?imgmax=800&quot; height=&quot;198&quot; style=&quot;border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;407&quot; /&gt;&lt;/a&gt; &lt;br /&gt;
&lt;blockquote&gt;
这里就是当i 等于 5 的时候&lt;br /&gt;
break 语句将终止整个for 循环&lt;/blockquote&gt;
输出：&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEih3CjSO-SlhkXaPZAYKfWt3XXvoNtqqnDm4IWaNPOkoIRDzB-J2Mu5myGhC0A78fIW70PTKG6Yth1HafLnHfVRPleKEe09xFPGwnC1iwRFeaISnAoq4On6So5BYxvKyUmbOf2KNgNWiiS9/s1600-h/image%25255B11%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjICf6QdRukldAsazcvwON5HRIUzAjwfpw5Zw24Nlb9URv0JtaH5UKXxMjD7rG3i_egIMN9iHW3-7onAWIeobrDoxbH8VCUefiduYCuX2h_jrlXGBRiLBgiQ5jN3oXyny1zzkneOZdeyjwJ/?imgmax=800&quot; height=&quot;300&quot; style=&quot;border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;300&quot; /&gt;&lt;/a&gt; &lt;br /&gt;
&lt;br /&gt;
当i 等于 5时&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg2siLoaqXlXzbiwhtbnE9XjjmAnMp2N5z7-2ak8VzFfccihoQ0QgHmFeMtLIlHQtIHC4cvwrhsR-t5IRtDaClC5OQs1E_EGKUzXzm6VMFcHjrHCjyDPncOU1UbmEyJWXd6U3S1TghLSLoF/s1600-h/image%25255B14%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhOo4uiULXLk_8LaoLXh5TI5N9lY5pQQfRny-GwZX1jdz_HZfgz_0pYHXdUON_WeeKAX4VZ6_7AKDF1Tw3n2_-09X2QhH4Ap38ulO7HTa_dfSwpzTX2eJQbxdJ2JfXcoe_6myZEJgcL6lHR/?imgmax=800&quot; height=&quot;265&quot; style=&quot;border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;438&quot; /&gt;&lt;/a&gt; &lt;br /&gt;
break 语句跳出整个for 循环&lt;br /&gt;
跳过 textbox.text 的赋值&lt;br /&gt;
所以我们在输出中看不到5的存在&lt;br /&gt;
&lt;br /&gt;
break 语句另一个地方就是用在switch 语句之中&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg2FTZnZh0Jahbe3MBDVfm02ejtnsRpiwxQlbDC3vzeIOvy8k95iCeOPeM7LhyprNNdstTJedkUQjQvN7yxq7uMbK-fAlQzXGNhPE2hCJU5imeiCtS2I-TZ3pTQW6vrxA8nPw26LNaHB8FN/s1600-h/image%25255B17%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh35D-IB4uON_EExCIo212_HTkIY7xHm-Zjp_4eXrfvrcXh4M59brQvH9FyO1Bhb33zl2uWiCFoZ6dieanD6nf6Zano40w7loH8S2OsciQHq42msBpk2cR9Q5FwUUwRbwLdmxellhpCFxF0/?imgmax=800&quot; height=&quot;222&quot; style=&quot;border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;404&quot; /&gt;&lt;/a&gt; &lt;br /&gt;
&lt;blockquote&gt;
break 在 case 之中就是当条件符合其中一个case 的时候&lt;br /&gt;
就直接跳出整个 switch &lt;br /&gt;
不让他进入下一个case 检测&lt;/blockquote&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhCB_oFT4JQ3i-6KaWXU0-IH5Br_avMyV0GYeykTYYHw7YaxGX4MbJXYrAQejvjpflDCOLu45PpXhFHKEt3vwBGsxhbnJT39RlJp_7lRSbipnaSKkpcm4vHm7waQNmoLENWdC4UZ5lm5aOI/s1600-h/image%25255B20%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjPFiN0mmbZ7_a9QvVVr3I5qaqicJAzzBzIvLSKrNN1p_kpLMNyVyVlFZRmS_EFCpkVKoOR_ZOBhEYTOWQoYAyVMxU353SvCDEO6SWmU01ILPmVEAxOcVZ8ILA2wXkWfP4vhRSpQq6Ns0Yh/?imgmax=800&quot; height=&quot;227&quot; style=&quot;border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;431&quot; /&gt;&lt;/a&gt; &lt;br /&gt;
如果没有break 的话&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi2GurRX2KnzteeY0DNNzXoOoGXYFpJEh4HNpu3ORaWcFP8SChcZnUiWc98-PdbOoxPkgcpKo8MnGKvvWEx2uVMAZVul3nzb3dYP0l5bzUd6wnU-Nwr_Wf1c6v7hDrERyiMu-6WF2W3LkJG/s1600-h/image%25255B23%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjeVr-t8EuVkVmNRFMXC-NY7OdmdirlmX6XOtJdu9b1ev3PvxMeU93ME21Ug6kgcRhOdjmkDvJ3n6mMwCbEoFKFORNCRFjkicqUN9QPHqdccJPHGo_aKQcNY0r-c3egyWuieTRGRqx7KG-A/?imgmax=800&quot; height=&quot;197&quot; style=&quot;border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;424&quot; /&gt;&lt;/a&gt; &lt;br /&gt;
如果 case 1 符合的话&lt;br /&gt;
它还是会进入下一个case 10&lt;br /&gt;
&lt;blockquote&gt;
但是当num = 10 的时候 &lt;br /&gt;
他不会等于11！&lt;/blockquote&gt;
然后你可能会得到意想不到的结果&lt;br /&gt;
所以&lt;br /&gt;
&lt;blockquote class=&quot;bq_warning&quot;&gt;
C# 之中&lt;br /&gt;
每个 case 都必须加一个 break &lt;br /&gt;
如果不加的话&lt;br /&gt;
就会报错了：&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEghq1QXM072X6OTvpmKwmWBd3xwrd7Ja06JG7-1uUjY2ax-9jNIieRpaFVQbHk6UwHTpyhv0pPYD-QwwuFp52jysGWqdvGlnpYoVvHpcfCJsojcq57nWl8Ka4ZOgzDodX9Koea-1Lu87bm4/s1600-h/image%25255B26%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjj54bHIZk2r62RUSmg7MyVuR8JDwx1nEWXE3M_0e9XmTdbgoqwsy6PqtssmiPIrLuXBh_xTf3s270pJCGpG8M1rTjiiM0wEptUt1TMstCdTVXuRp1Q7RK5jKilEd9P-9ZZTEf-wl0geIyc/?imgmax=800&quot; height=&quot;209&quot; style=&quot;border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;513&quot; /&gt;&lt;/a&gt;&lt;/blockquote&gt;
&lt;div class=&quot;blogger-post-footer&quot;&gt;&lt;script&gt;
SyntaxHighlighter.highlight();
var linkwithin_site_id = 1130633;
$(&#39;#toTop&#39;).remove();
$(&#39;body&#39;).append(&#39;&lt;div id=&quot;toTop&quot; onclick=&quot;$(\&#39;html,body\&#39;).stop().animate({\&#39;scrollTop\&#39;: 0})&quot;&gt;Top&lt;/div&gt;&#39;);
$(window).on(&#39;scroll&#39;,function(){
if ($(this).scrollTop())
{
$(&#39;#toTop&#39;).fadeIn(&#39;fast&#39;);
}
else
{
$(&#39;#toTop&#39;).fadeOut(&#39;fast&#39;);
}
});
&lt;/script&gt;
&lt;script src=&quot;http://www.linkwithin.com/widget.js&quot;&gt;&lt;/script&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://garyngzhongbo.blogspot.com/feeds/6328552242317449154/comments/default' title='博文评论'/><link rel='replies' type='text/html' href='http://garyngzhongbo.blogspot.com/2013/12/c-19break.html#comment-form' title='0 条评论'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5319618319979683940/posts/default/6328552242317449154'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5319618319979683940/posts/default/6328552242317449154'/><link rel='alternate' type='text/html' href='http://garyngzhongbo.blogspot.com/2013/12/c-19break.html' title='[教程][C#] 新手入门教程#19——Break'/><author><name>Gary Ng</name><uri>http://www.blogger.com/profile/00014057672539539340</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgXMDZn-tBPbnmHMncRIOPSCRpPl4UPjK45y0DqWYQoC9ejFedUkyPeJlLFWSxKxZtsPNaZcnwZE-gLwi4Hlg_JOe9r3YKbt21up6A4rkbTHzzOstYEdf0MiIxv_y3UqCKzG6tQVF66uGt8/s72-c?imgmax=800" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5319618319979683940.post-2595227701935540427</id><published>2013-12-11T11:58:00.000+08:00</published><updated>2013-12-11T11:58:54.947+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="C#"/><category scheme="http://www.blogger.com/atom/ns#" term="入门"/><category scheme="http://www.blogger.com/atom/ns#" term="原创"/><category scheme="http://www.blogger.com/atom/ns#" term="教程"/><category scheme="http://www.blogger.com/atom/ns#" term="新手"/><title type='text'>[教程][C#] 新手入门教程#18——Methods</title><content type='html'>当你有一段代码一直被重复用到时  &lt;br /&gt;
你就可以将它们提取出来，放入methods （方法、函数）中  &lt;br /&gt;
这样你就可以一直重复调用改方法，让你的程序的代码层次更加清晰  &lt;br /&gt;
函数的申明方法是：  &lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjgDzUXhxH15n326of9FtLh4rt_8Ua5yghzl1UQ_9EhXumm8LwqrTjf7xAnp0jJGDuqrIidmT5SoqYTcxNa7A2F0NtDKCX8rEM4Qg4JBmOlJhMqyl9zMGJX6W5iC_ME38ZEouezc9HwEmek/s1600-h/zrclip_003p41a4041e2.png&quot;&gt;&lt;img alt=&quot;zrclip_003p41a4041e&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEizHKFjQwJTzyyT-cndMJ__np54F9w8kLb2r2fKOkmEwcyDnmvhhQHKLpC44ZOSZjt9X29sstsecAWdRld0gW7BfKt2emr6JoQxvDwsCs5WXU7xdNMuJMD1iEZ6-csrhSd15t68W6uzTP75/?imgmax=800&quot; height=&quot;91&quot; style=&quot;border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline;&quot; title=&quot;zrclip_003p41a4041e&quot; width=&quot;484&quot; /&gt;&lt;/a&gt;  &lt;br /&gt;
&lt;blockquote&gt;
&amp;lt;Access Modifier&amp;gt;  &lt;br /&gt;
这个是访问权限，种类有：  &lt;br /&gt;
&lt;blockquote class=&quot;bq_info&quot;&gt;
New, Override, &lt;strong&gt;Private&lt;/strong&gt;, &lt;strong&gt;Public&lt;/strong&gt;, Static, Virtual&lt;/blockquote&gt;
&lt;br /&gt;
&lt;/blockquote&gt;
&lt;blockquote&gt;
&amp;lt;Return Type&amp;gt;  &lt;br /&gt;
函数返回值的类型，可以有：  &lt;br /&gt;
&lt;blockquote class=&quot;bq_info&quot;&gt;
&lt;strong&gt;void&lt;/strong&gt;, int, string, 等等&lt;/blockquote&gt;
&lt;br /&gt;
&lt;/blockquote&gt;
&lt;blockquote&gt;
&amp;lt;Method Name&amp;gt;  &lt;br /&gt;
函数的名称&lt;br /&gt;
&lt;/blockquote&gt;
&lt;blockquote&gt;
(Parameters)  &lt;br /&gt;
函数接受的参数&lt;br /&gt;
&lt;/blockquote&gt;
&lt;blockquote&gt;
Method Body  &lt;br /&gt;
调用函数时会执行的代码&lt;br /&gt;
&lt;/blockquote&gt;
&lt;br /&gt;
 你：那我要怎么样申明函数？&lt;br /&gt;
 我：在外面啊..&lt;br /&gt;
 你：啊？&lt;br /&gt;
 &lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjy-CeWAASiO_tHmjaDBvfSOuXVymbuLMK7iYIDmn21p7vELiOaKOwtS9QlIuOyc4IAY-pcY2Wq5KMhWrsC6Ck-9mUqDeT9PJf1bX4A4PVmR99fcSOpQPsMACXUaLe7v8-B1U0MzArfRnQ0/s1600-h/image2.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjNN0W7_waYzrw4O3_mmtHE2CSbeotZ5mF_tizR5GV-qq6UCVvfjGwxlf-krb4I0_rbNQyFgvvwv_mOk3lNkt0TO3oSzS2xaVfsbh9vdbfZ7g8ebJ3xya_zknVDRvp6CcOSkujytXYAxlQF/?imgmax=800&quot; height=&quot;431&quot; style=&quot;border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;516&quot; /&gt;&lt;/a&gt; &lt;br /&gt;
 其实那些被红框圈起来的东东也是methods!&lt;br /&gt;
 所以你要申明函数的话&lt;br /&gt;
 只要跟他们同在一个层次就行了：&lt;br /&gt;
 &lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjf6HDjIue1h5VWmn2ITkQglrYqF3J3Yrj4JCvNHTGQ6zVwlnzs6U5zc2kK7sII0JdwfnCyKyTs_xpySf2yF428fnGdfLdYhNbhU7LP36_2YDg73ua835qDuqmrpHSujtzZz1YXIA-rYOHy/s1600-h/image11.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj44idtjfCp5LFdG-jY9DEkUhKog-6DVTiV-P0WJ1POaX_N9Ry8nvP4c2BTbjtiO4RtsXS5voo_rXPFA-ll0V51TjXF50fJj_JUXEoxdzjRe72xidE7RVT6dJg3ncow9f-Qife4bYhJe1XR/?imgmax=800&quot; height=&quot;469&quot; style=&quot;border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;528&quot; /&gt;&lt;/a&gt; &lt;br /&gt;
   &lt;br /&gt;
 比如说：&lt;br /&gt;
 &lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhszw9JAAVe8hCox7Txzin-U90c3_ZwH9PnxsSCDPqDrUpykyEhQd8YEbkIv4PbBlJ_soIzhz4mBkp2RuRL6Yyij7fdu8NnrrV3o4ebA6JGzFucYiju0dR5B_mqgDEI-Nc39tOErj0xuiUA/s1600-h/image20.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhUVtRlvfj6pjYD82A_uUHb656nf5eLgu1hdTO0qr3pTyBoOKXnIwNaBacP_r_Pus-1ZaNABZFYMmUnKU2VJQGrUI6hxTorLlBdXFKsoh6AcWbEdpcK2rQAu6-E3vMKKpaUnuRbwPwB-RFc/?imgmax=800&quot; height=&quot;476&quot; style=&quot;border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;501&quot; /&gt;&lt;/a&gt; &lt;br /&gt;
 &lt;blockquote&gt;
void：&lt;br /&gt;
这个是一个特别的类型&lt;br /&gt;
表示这个函数没有任何返回值&lt;/blockquote&gt;
&lt;blockquote&gt;
ShowMsg&lt;br /&gt;
这个函数的名称叫做ShowMsg&lt;/blockquote&gt;
如何调用呢？&lt;br /&gt;
 很简单：&lt;br /&gt;
 &lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgflX6ka1UIHospbab-Dvk2r32yHeERCdBqqyLKL_XK9z81EPKUYnH2HobpOzjj7ZCau8gMpjHRhzczaHYKAKlEkIMxSIOgAVp5HRdi2Cch6T_TfS5ss1IzMQ6GYc2LXNIn2V1TJv9VhOxC/s1600-h/image23.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiOVh3yIXDxRTo_eoUDxIBSlmqD-Qtf0sJSh23WVyM9uM5gC8uwDvFkL5MOIevXNSNxdrgC8tJIbZrA3A6vOqcXvrPZlX7N0Ozmgr7Bd8C62rIw5nlDrOT2PKJRuJHLLGCcze_Ju0ZkuqNz/?imgmax=800&quot; height=&quot;200&quot; style=&quot;border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;446&quot; /&gt;&lt;/a&gt; &lt;br /&gt;
 &lt;blockquote&gt;
就是函数名称，加上（）还有；&lt;/blockquote&gt;
简单吧？&lt;br /&gt;
 让我们来试试看：&lt;br /&gt;
 &lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjm32HTkJ1bFTrB9YNx2xN_LTjfhmZ3nY6bhaLeeQgHmWRkIxXeOih6h1twGQa7RpIbKCVZ-jjPZwYDTqGOixdxX6bNGvE0dataPvEDnFuIlafx4flIUb6Os2SijoS5lkSMjFZ-cI4Ws4c3/s1600-h/image26.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjNGeNQU7xWItip-Hh4zEWbIxUhdYxITzV5-CZOUKfGfKl1Ie89EF8auliapAPERsHRq1rc6-9bsRTHPkaFk7AHAuZiF6-uSNqJ_zIcO6AthhQyPTtD6wNc41S-PEkpmnpXT5mj6vgWqj7J/?imgmax=800&quot; height=&quot;300&quot; style=&quot;border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;300&quot; /&gt;&lt;/a&gt; &lt;br /&gt;
 然后点击button 的话&lt;br /&gt;
 就会看到 MessageBox 显示出来了：&lt;br /&gt;
 &lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgmvzrOJNibfTm3DZJIuuF_iSNwuJ1_7xB1qLKLUCf4ws8pT7OSAxCU5vRrnwvmlHEGzH8GkHV1n9mBmoIw1jLFecY5uLjPGPUxKe4bcGSSA1-ondAFV2blAivzBqitx6KYXaqdimolDwjf/s1600-h/image29.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiwT0wUHnw3AYLirQ2QFSs10Gwko5fgWQ-TUHbXAtpnp8glkXGiJ0ABVjinMOTIgeCSRh6vt1X9xw4WG8-YHqN0SYdF8MpYeOlSgyqBlFP36mFHDiKlR7w2kV2oz6iXdSoZdFhrjcQqattL/?imgmax=800&quot; height=&quot;300&quot; style=&quot;border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;300&quot; /&gt;&lt;/a&gt; &lt;br /&gt;
 &lt;br /&gt;
 如果放另外一个buttton 然后同样的调用 ShowMsg()的话：&lt;br /&gt;
 &lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjvalwo5XXc_ZkeQRY9IIMvrJk21jdIWVypEGv6otQ9QWRLF7c6Cy2cXkV7GpMZqtRSGWPQFrv0wiTfauWJaFZ8q4LVKuhkldwdCIGwMqA4y7ciXTBmHfiV2OEdUDP_8BQ10WAaMZ0FoZB3/s1600-h/image3.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiwxz2zAVeSfRb2lWZooqi_5_K3vSUsqGZMFQJvAchi29WuoPVtJdYxxW-kQ6kLypiatN3uGersD-B_HVH31B1imlfcNwPA_OcbPzntbgOCBHv1qD7CaanHktCXJYpNysj3vOHgRL4mOqmx/?imgmax=800&quot; height=&quot;300&quot; style=&quot;border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;300&quot; /&gt;&lt;/a&gt; &lt;br /&gt;
 &lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEggEeoFpSU2hp7CMg8G4jCpjJ_IaMrt2KnauUUMU6G0LujEKkWT8F-DXg5D6NRsCgWu828Pz2zzY2LkuvUgtvfcKZyDWkMby3BM_lk6gEfGcuh_H_sbocm5Vg-_GdbxCbkfrFIp5keKG0G1/s1600-h/image6.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiTU2qgTJbp7ZEEbALbxwEp053kUuTc08LFtkVDSlgEi3imPIC0u7LrUYbO3jBwWwkJcX-PByKaWEUfU8VUbg1dtQ4cRWQPgUg810ZtANTB6Xn579HIhxY5lQfMrTmFxyVayi6oaqEUM1XY/?imgmax=800&quot; height=&quot;300&quot; style=&quot;border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;300&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 你：那我不要两个Button都显示 Hello! 呢？我要一个button 显示 Hello! 另一个button 显示 Bye!&lt;br /&gt;
 我：用参数呗！&lt;br /&gt;
 你：啥？&lt;br /&gt;
 我：Hello! 和 Bye! 是什么？&lt;br /&gt;
 你：英文..&lt;br /&gt;
 我：…什么类型啦..&lt;br /&gt;
 你：string ！&lt;br /&gt;
 我：所以函数就可以用参数了咯！&lt;br /&gt;
 你：啥？例子例子！&lt;br /&gt;
 &lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiSYHj-frsTWGpMZpIwsOp7tINjk2JNPNxGerR20F7wcc8QC5ux6EzMVkmDseYZ_rO5rRx-g6Cb_whFSGmdAcEr8qNJeVFpyhXL4Z_s2H2rHIIAnCzLW3HvwuglEh9T4Waqi2g3uD6neTgc/s1600-h/image9%25255B1%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh08D4lUxIomJ5OjedRHsM_wE8tFFMUHRgTDCGNAjReDGJHX1Q3D3vyMlP2HkFNVOwyPOWRmoys58TmFVU_yLoz8T3XFq2-0o7_9zxwMnwrak0Ql-LeP793ZQyUVSRqNBmE2Xjx8htqgNK1/?imgmax=800&quot; height=&quot;248&quot; style=&quot;border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;419&quot; /&gt;&lt;/a&gt; &lt;br /&gt;
 因为你要显示的文字是一个 string 变量&lt;br /&gt;
 所以：&lt;br /&gt;
 &lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh-389c1Oge4o6bdo-C-8Kw9UAxd9ZDG-sei4_XtbqZyrNXRSxUKZuIdtKKKjjvTCAr6M2BUYVe100PyW9B5DjXAEGD-HN-bmd-Hd4AoE65tK_3F55h8UGB0rhd3q6L-OCke05evBNl78CK/s1600-h/image12.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgE0jjVWpgIvKOzG4y1o_oVS4FGnIVq6035O1toTPjmo56wr0lH_b99IIOEbAQ9wYGdPQXGBprKQ1LZbASSAvOvMA8tFzjN98VRGwODF2QmXDfcsr1Z8jX1MRw5yvLTTaY4XjV-OSYth6ok/?imgmax=800&quot; height=&quot;220&quot; style=&quot;border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;433&quot; /&gt;&lt;/a&gt; &lt;br /&gt;
 这样的话&lt;br /&gt;
 你的函数就会有个变量&lt;br /&gt;
 名叫msg&lt;br /&gt;
 在函数内（只可以在函数内）就可以调用此变量&lt;br /&gt;
 而变量里面储存的就是在调用变量的时候输入的参数&lt;br /&gt;
 &lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhGeGiTV2RKmS5EK0EtNoByUAmhfPfDdm0W6CUtXrTCILr6RWl7firXUQgPrmyLNvelHNDWVBWFTbmKlB5rQQgdYDH42iiUHcqPtkEcPIMgFXEnRBb6-Irl1ONAcRKmSPmAv3dCDzLoPJZc/s1600-h/image15.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgMzXueU85ES-V4_NxWnBdWoTj7KrKVy19jOtwgfXbF69iwHWSXbTSMc-4mj3MAdVrZZsikaQ4rWpP_dXIv2aQAxY3zGPVG4PQIFW7RbLWKlxswtH0m5gUBKizzMD1Pagx4udPyisgF68RI/?imgmax=800&quot; height=&quot;222&quot; style=&quot;border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;409&quot; /&gt;&lt;/a&gt; &lt;br /&gt;
 F5运行：&lt;br /&gt;
 &lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgnEkddVCdoPpmX2Cl3Bbc455giLCLWrgbFYlJ1ZzHd4U2dnLLLQy2oDJvE64QsIlcm_KOWulBmN7_KxQVynC56QxOO8g9yaEnGYU2xLrRrGB4gcaiuqBEdTAHEmYH-ZUObD4tHN3NN6MyE/s1600-h/image18%25255B1%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEinDMnvikCYdKzA5xUR5qs23le5jTTlqnmSdu7eWC6wNVpJk677awY4RSULK0hJWCLw1XnChFmq23vWWDg5Tu9vL52N-TyrpadVJFkOWiTxW-vVKDWzqbvmcpePu4ZFyg1mzDYos0E5SKCh/?imgmax=800&quot; height=&quot;300&quot; style=&quot;border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;300&quot; /&gt;&lt;/a&gt; &lt;br /&gt;
 &lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiCsFCsrkV-jmSaGNPVJhsNGlY8sOOa0maNVvH0WmUlVaDjsH6Nhe_Jn5bjxjyLtWJVfS40DyVDRFD_SRScpEcLvuB8SewefH_k0Gq1NvbVdEjb0EL94dPBDLxESNR8JyNfryoJX1X5AgfU/s1600-h/image21%25255B1%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj6StjA9E3zF81l9JYlADc8sNSrznoRAmIUZEdyKGogWUoIWSisQDhhStTN6aRgpV1PQjKmKJFOD-uE0TWgSjAqvGZDsbll-wlkSJ5SzhxMylykIMIoB9lwEgh91nfsnaOyjGvjLu5shk-n/?imgmax=800&quot; height=&quot;300&quot; style=&quot;border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;300&quot; /&gt;&lt;/a&gt; &lt;br /&gt;
 &lt;br /&gt;
 你：那如果我要两个参数呢？&lt;br /&gt;
 一样的方法，只是在两个参数之间要用逗号分隔开来&lt;br /&gt;
 &lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjQQhaOWhpgFTrrLY7QFz1JJw_CEAuASswNMxFs2sb9RFFF0P8wDi8qhd5uqL-Wp7hKgxI7x2UqPiAuPi-pE2CtdgCX_vNXj359-BsU1acWWuk60O6OIBS5RAu_4v7III8Sv4S4-X8K-JQ3/s1600-h/image24%25255B1%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEho-UedjaYm9H_V20ez6RiybffcYY9qSIKr6B5IFFJjBepDNLXCk6dquReLtuczCHJgpXA5daZQR-ZY1sYkkWPAHP9KC9xe10vQkq22NTmmcbUZNUpljpvX3gkZbhgcKQBcBLrZTgV7OJqV/?imgmax=800&quot; height=&quot;218&quot; style=&quot;border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;411&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
 运行结果： &lt;br /&gt;
 &lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgQAV_r0IzaJZHwd3drrVAv4Shx5wkc7tE9SnLweMsORDwuWCnR2EK1YrMdRU3hxRMq-T7OHKeDbmWgIxkdyqPSjPB72zvzSMB5JLbBKzOEZSe4qK0DbZzTx-vK63J9l_6IcQishFUT1Pba/s1600-h/image27%25255B1%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjd2WpdvdsiR3KIzH7Vt54kjQcAghYhhhY7wGfLyxJEyw4EHX4rzM5CU_s0EAUsIXEMPY8We100Xr6pEBFMATeKBIu-qy6i248B-tKyQY6gtOUhx5FXiZQW6nQcD-5o8sbns5dmnf_o5uNZ/?imgmax=800&quot; height=&quot;300&quot; style=&quot;border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;300&quot; /&gt;&lt;/a&gt; &lt;br /&gt;
 &lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjjy_ZwtqotT3Yh7krNEDh5QjEQ5cUIP4us7oOkUw6z_1-bo8qTA_fw69ENSLRzH2evCaN45K9Gwrqr3n1WpKONrlXwUEbT62sUogYpK5MMY-AI1fMn6aYftTPc4DB-jj20WhX7T1VNryJi/s1600-h/image30.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhp0ZTirhouyVwf9hTUL9UvF2VnZDXMnhDD2Hwz5lf7ZmliNoPeYWpsTQ_NmHFDK7cVKT6_tUkTBAH5OYSO27ORyN1sW467KIjSN9CzsE-upvfjqo9HiW96nzg5VdwLBFFrpYBfkpVKzxMg/?imgmax=800&quot; height=&quot;300&quot; style=&quot;border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;300&quot; /&gt;&lt;/a&gt; &lt;br /&gt;
          &lt;br /&gt;
 你：你很像只讲了void勒..我的int，string 等等的return type 你还没说呢..&lt;br /&gt;
 我：好好好…&lt;br /&gt;
 比如说你要一个函数&lt;br /&gt;
 接受一个参数&lt;br /&gt;
 然后函数就会返回 参数传入进来的int +1&lt;br /&gt;
 像这样：&lt;br /&gt;
 &lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi4UJd7MKsyjMpTYLpsngFmMCRN8bNVBAxFEBjyYCYzsuGHWJP5NUe_lsjF_lJqfopTMZ8zGAajyb4-tzHFXPTHywddIJ3BI8fgPwvcEl2h7-4HgeUHvtzFibcjdCjfEgYgF2uK01MwbLvA/s1600-h/image%25255B9%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEivHVUMPhiE_Qa6akvKJdsrXtqlPNX7avGEhzu0_ngOWlwEHbGFmRPk9Jtd93CbK_3O1kXCWSMZJhYMomDVQSeJTtOAOm_vTsKlAiZmvTHABfjPNhNkgTrdqntyd8A2ttgWBiAQlIsd-WCO/?imgmax=800&quot; height=&quot;287&quot; style=&quot;border-bottom: 0px; border-left: 0px; border-right: 0px; border-top: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;485&quot; /&gt;&lt;/a&gt; &lt;br /&gt;
 &lt;blockquote&gt;
return &lt;br /&gt;
很简单&lt;br /&gt;
就是直接跳出整个函数&lt;br /&gt;
如果return 后面有东西的话&lt;br /&gt;
函数退出时就会有一个返回值&lt;br /&gt;
这里就是一个int 类型的&lt;/blockquote&gt;
如果调用时你这样写的话：&lt;br /&gt;
 &lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj08WoDbAZYsL7J44P_ZqXnVrR8L5ettJdoJCqqEQh0yJ_hRjhlX023ue7dwYbhhc0MqU5kCFGYGdOss1GqjkgGDtyNgw4wyk33vlPTI4fEwS9JgRoWdcf3GvG7BDQvZv4pS7kevNxRoBxs/s1600-h/image%25255B12%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgXA6oXGimlvRqvdvVmHQdWGZJvs5Liz7lAWAwXDzWAnB1dawUAyOGLSi5be9zU8cSQjvJLDZoxH4Rx6cSYxdLjHzjkER0d-wnBV2YeIVrB9brOZwfmdCjomYNjwWReGkKXIQpGpBT9Kdm9/?imgmax=800&quot; height=&quot;117&quot; style=&quot;border-bottom: 0px; border-left: 0px; border-right: 0px; border-top: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;421&quot; /&gt;&lt;/a&gt; &lt;br /&gt;
 你会发现到运行的时候&lt;br /&gt;
 i 的值还是一样的：&lt;br /&gt;
 &lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhfpjpFkOa-IbqG5h0dVrI0-gpHpWXK4iLwOArwbD2EJ7YNjYGKOWKUN52DWSq5KNpux_Nbina6YfWWMKE1oF95S7BsqO5B14bFbBAQSmjFbN_1nZM22GH7uIBQ0y1IryNfcjwpxNRgM4-1/s1600-h/image%25255B15%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiLxHn0Rq71yIpdVAQ1R9rH5miXs50oFjp85sNcpoKbo9AdOUij258D0g-tmHtAl-vXNUomoQnJZ2XY90vEo0L-uFGqpdIaL0k-fud_M6FJuEWP_vPm9_oW9PzZmCT96oNvGy4JdPwO5Opp/?imgmax=800&quot; height=&quot;300&quot; style=&quot;border-bottom: 0px; border-left: 0px; border-right: 0px; border-top: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;300&quot; /&gt;&lt;/a&gt; &lt;br /&gt;
 为什么？&lt;br /&gt;
 因为返回值没有被接受到！&lt;br /&gt;
 函数返回值可以直接像普通情况般赋值给任何变量：&lt;br /&gt;
 &lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhZRanVZBKgQuOfHgQUxpfscl5DNsVp3ef2y2IG3n3oyjLTDiVUJi8X2qv8BXx1opElLcVjU_lR0pGVZksvGoz3tGQrzIQUmxEKnrpDhycu7KHf8OxwvgJaAuZQIKFWIDMh6jDKsTf-oA46/s1600-h/image%25255B18%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjpR-57Pb9pN8ibRtxpx-5Z1KmdRQeeUzlgyw0p1v1NppPpVUQC786lZLGthnX6bLaz5d6_YFPmIlGhkd8dbR9vfFGN0sEDLi74wNlL8-p1KXW-ItdUzN4kLy_7mhULeIZJN2bC8Tz1Y2dU/?imgmax=800&quot; height=&quot;207&quot; style=&quot;border-bottom: 0px; border-left: 0px; border-right: 0px; border-top: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;419&quot; /&gt;&lt;/a&gt; &lt;br /&gt;
 然后运行：&lt;br /&gt;
 &lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh-51WF_BpuUJ1zz6hE9-DGMJYZaZTIa4KDtM8pBbjp8cF95CTq3r7A-GVC-vlsBDHzCi9p60l-CQQRTINDTvlisnVI1xVw5PZULWQ4QQc_q6pxZHlmgQiEXztTulZr_6NMXYW3ONJR7po2/s1600-h/image%25255B21%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi4k8QGDxfiz1G0UJ87DEl9P5fhEViO6Nxa_0miuPlRjkFdiaAjaAPDLM5wLzAy84jdfI2ISNT5k7BTDwqz6bS0dm4w4PKVsludBdd0_9CMidyvE1pytUEPJ1cHLpv-5hcoWHfBhHfeiLR7/?imgmax=800&quot; height=&quot;300&quot; style=&quot;border-bottom: 0px; border-left: 0px; border-right: 0px; border-top: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;300&quot; /&gt;&lt;/a&gt; &lt;br /&gt;
 明白了么？&lt;br /&gt;
  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;blogger-post-footer&quot;&gt;&lt;script&gt;
SyntaxHighlighter.highlight();
var linkwithin_site_id = 1130633;
$(&#39;#toTop&#39;).remove();
$(&#39;body&#39;).append(&#39;&lt;div id=&quot;toTop&quot; onclick=&quot;$(\&#39;html,body\&#39;).stop().animate({\&#39;scrollTop\&#39;: 0})&quot;&gt;Top&lt;/div&gt;&#39;);
$(window).on(&#39;scroll&#39;,function(){
if ($(this).scrollTop())
{
$(&#39;#toTop&#39;).fadeIn(&#39;fast&#39;);
}
else
{
$(&#39;#toTop&#39;).fadeOut(&#39;fast&#39;);
}
});
&lt;/script&gt;
&lt;script src=&quot;http://www.linkwithin.com/widget.js&quot;&gt;&lt;/script&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://garyngzhongbo.blogspot.com/feeds/2595227701935540427/comments/default' title='博文评论'/><link rel='replies' type='text/html' href='http://garyngzhongbo.blogspot.com/2013/12/c-18methods.html#comment-form' title='0 条评论'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5319618319979683940/posts/default/2595227701935540427'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5319618319979683940/posts/default/2595227701935540427'/><link rel='alternate' type='text/html' href='http://garyngzhongbo.blogspot.com/2013/12/c-18methods.html' title='[教程][C#] 新手入门教程#18——Methods'/><author><name>Gary Ng</name><uri>http://www.blogger.com/profile/00014057672539539340</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEizHKFjQwJTzyyT-cndMJ__np54F9w8kLb2r2fKOkmEwcyDnmvhhQHKLpC44ZOSZjt9X29sstsecAWdRld0gW7BfKt2emr6JoQxvDwsCs5WXU7xdNMuJMD1iEZ6-csrhSd15t68W6uzTP75/s72-c?imgmax=800" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5319618319979683940.post-1149647047022101610</id><published>2013-12-06T11:48:00.000+08:00</published><updated>2013-12-06T11:48:36.985+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="C#"/><category scheme="http://www.blogger.com/atom/ns#" term="入门"/><category scheme="http://www.blogger.com/atom/ns#" term="原创"/><category scheme="http://www.blogger.com/atom/ns#" term="教程"/><category scheme="http://www.blogger.com/atom/ns#" term="新手"/><title type='text'>[教程][C#] 新手入门教程#17——Try..Catch..Finally</title><content type='html'>如果在玩数组的时候&lt;br /&gt;
你很鸡冻/不小心的输入：&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiutTj2WBwM6dZ5KDgS4HVgN_wcA1g-0YgR2E6HCu3wfp7kkRcZ4dNpL8SlAwC1V-Ci3N9vgYlaHeqHuoJjqoPm_HujjiySWIJF8S45dnd7XIkq59fCb2XsJML1f9HYcxN1iIBCQ8odghyN/s1600-h/image%25255B2%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhDQPdybc1riyCZNeVHSnDK1xv9kF70zlz-Mt9xHCggkXCOjcEudHsdp5oTn3JDQbjXYnsPqXFWw6cmCJcS67gPg52Ov9A2ukP61ZsO1JKn7T89cXjy7ugRL-fVKLj_UUnVFuznrOHsM0iW/?imgmax=800&quot; height=&quot;91&quot; style=&quot;border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;420&quot; /&gt;&lt;/a&gt; &lt;br /&gt;
然后运行点击按钮时：&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg03IemnUeBT7mG_sDjMTpbAfgQansaKTmXpU-9miggjbbBcrIcZSpfPzfl1HtVYAgPMrpWeado3kxPLzi8DYMkAIlxphc7ExXV8ig_DJ3fPhzSNZi0OKwA_TNH5bq8DmgUjQ5Jfp2wqH6J/s1600-h/image%25255B5%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg5jseorQVYoDaieNkdGzxAZPOwgKEAl3_z8UMCsabxmpe3sHf1nDMXTnkQrx2ylPoUthizws2oGEQ41hpIyd-i_CSNDFjZiCructQPx_PmNHom_b3I8QXrGTLIePCvuamXHT9wuBk9pfXZ/?imgmax=800&quot; height=&quot;300&quot; style=&quot;border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;300&quot; /&gt;&lt;/a&gt; &lt;br /&gt;
&lt;br /&gt;
VS 罢工了！&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhUZWwp5naL6ZY55cZeBocyhyROrrrh1DLrGgfznEMLoMErGX4jplod6xhnnDY7jUjg7cT30VB5O8RMlNEM6U0W0X2AgNNezz__Mqc5b0KPRqdjW_o9InQJwoO6Gzsf-hd0XoA_Lt72AYIG/s1600-h/image%25255B8%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhFbSJHO6KK9BY6VbVQXspMNSSSdGGXuaovbHjjraQ_TxQZcmkaCEOVm_P-pUOKoatDIflHeVldUAZtXb_EImNxCSGraNJpdPY_DpXEUUMou84Ox9KHLBgSJeEOPM9tujngwYpkPMWA838y/?imgmax=800&quot; style=&quot;border-width: 0px; display: inline;&quot; title=&quot;image&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
为什么？&lt;br /&gt;
因为&lt;br /&gt;
&lt;blockquote class=&quot;bq_warning&quot;&gt;
数组str没有index 为 2 的元素！&lt;/blockquote&gt;
&lt;br /&gt;
你：我不要这东西！我不要！我不要！&lt;br /&gt;
那你该如何检查这些错误&lt;br /&gt;
然后handle 他们&lt;br /&gt;
防止整个程序挂掉呢？&lt;br /&gt;
用 try .. catch .. 结构！&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj10ryZUVmYfaMAwaUwqt0W48mj-Pemt-W4r5eoJXpfN9vUhm2MDpcyFdBOfqZ0vAELBvH4FG_MEmHfaF07zMu8FwUtGbYnDt83lnkki71nqDMSAoLIX1h_G1-si0jT_brL5MpiY3A8NIl8/s1600-h/image%25255B17%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh6Znj4snpro-vJWPEiwKTSzYVGS-xognbvG6E-Pio4ViWt2WviRriG0PgAfH3dA0Cijg181J2p9AwdBo9tv6SPdX_ylObnbSXotZBPADCC23OYDBcFPtRrI42Du0xSoL6Z-nDdB_WpY9Yw/?imgmax=800&quot; height=&quot;156&quot; style=&quot;border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;199&quot; /&gt;&lt;/a&gt; &lt;br /&gt;
&lt;blockquote&gt;
try&lt;br /&gt;
首先它会运行Code body1 &lt;br /&gt;
如果没有出错&lt;br /&gt;
就跳过 catch 中的 code body 2&lt;br /&gt;
如果出错的话&lt;br /&gt;
他就会运行 code body 2&lt;/blockquote&gt;
来看看例子：&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhpvABzx0cJEOEsKGwo6PsN6sEbGTopyMwZg4keGJs2u5rY3yjbFquWridwva_Ihg1IXDcfwa1Ues0uGQ5vY3g8Dj_EnQRLFAPNp-XRd0m6-UhrrOFOWJ4oW89MA739n7W7PANdcZNn8XUU/s1600-h/image%25255B20%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjxUHKR6tB7qcjJaQ-5QNUJb11BDk3iBVy9lcu2CY9BjL1zSghMVLCoWmscqKxNo5fPTolZayiIxa2gIM0C_L6JlmU0d1_pMwGFGr9tp-jkC3rqSyaJK3-YNEPYvk2rC82oYU8UJytIV63i/?imgmax=800&quot; height=&quot;207&quot; style=&quot;border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;408&quot; /&gt;&lt;/a&gt; &lt;br /&gt;
如果try 中的代码出错的话&lt;br /&gt;
就会有messagebox 跳出来说：&lt;br /&gt;
&lt;blockquote&gt;
你挂了！&lt;/blockquote&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiyTXjyjUApWjAQ1dCEBPatvqHiiDCxVNxz2KYydU9cwNs3OGf05iGJRxXRjKOfrQeEkmItoewlUX2WhdgmvfShKrYLCRb7DtyZeAlV-bXUgPzmOfGAR206c1v0iGLSyORGu82_zMhejf3a/s1600-h/image%25255B26%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgYXnmMg9GsHlyJACWkoyF8WFy_E2TDawR7G4yhJIcSJkPIqKrHvuMOEfuyL8mYtWMDjEntzwAiyHORWExuEo61_LbEibwYgU2hA9Ut37uQRJdRbbGwoHFTmocuGpoe25McnzD7ofCq5f07/?imgmax=800&quot; height=&quot;300&quot; style=&quot;border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;300&quot; /&gt;&lt;/a&gt; &lt;br /&gt;
但是如果没有任何错误的话：&lt;br /&gt;
&lt;blockquote class=&quot;bq_info&quot;&gt;
str[2] 变成 str[0] 了&lt;/blockquote&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhfdEJkBkFWegZPzHqu6y8gC5XmxxgF-zKhqJA5kxlV9ream7hNrWejcuGRSzRn2H66ROe3CcyBbZmARklRX07KsnQOxazq_fP0cA1mRPmvKcCtLyUml3OQThgj0PliFfGag6qmZEGQdoGn/s1600-h/image%25255B29%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEimzPfT18jbE_zq0HDYhHCVawuaTF6dw4aNymvI43q5_uYvD75Y2rie2cFxgfVA4lbafMBbcUT3Ug3wTbLk_rPfdYHb8EgBdLsKNwU0Wxuwi9Qkk-Pi9E-YrHiqqRZwlkeZRvqj2SHx8CUf/?imgmax=800&quot; height=&quot;201&quot; style=&quot;border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;407&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
运行的话&lt;br /&gt;
当然没有任何msgbox了&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh0w-OiXj9wB5oPU4wC3vCICebsY7Tm_enxTsok92uqlp9V0ltffg72ki3Zex5N2VZWKezL7MbGUDiDJPVULxsC08e8-ACPrDL3mamqZvVm13M3Y3oa6-dISoE7eT7wBwuFzQJNrDmQDYCe/s1600-h/image%25255B32%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhZpwj1wn9Mi1cVeLoLIlrTsiNDBBOsjSQRmakEtMGNQtRKqOZo6JeNLKVRPWG53DXSYncO_3pvIiCksr9ZI1mZ8nF3bIMN1vKv0XU-R23Go6yo2531lrQgTr5m6ZMCWSkhVbMnIiYsAJlf/?imgmax=800&quot; height=&quot;300&quot; style=&quot;border-bottom: 0px; border-left: 0px; border-right: 0px; border-top: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;300&quot; /&gt;&lt;/a&gt; &lt;br /&gt;
&lt;br /&gt;
你：可是我能让Messagebox显示什么有什么错误么？&lt;br /&gt;
我：能！&lt;br /&gt;
只要在catch 加上：&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiosNN-9jQ2U8RCwsCdQdX5CSpmynpwx6wgqBljKo91Z1yH8Bby_pGPLr2ijyM_Qx4GDufIJdJUIBnmdw6EnnhZN4-SPtzrjdTmZrGSGx_c4-5KaYNDiNAa6C5vdrkD-F9Cd5sXnKa1JOQU/s1600-h/image%25255B41%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiOx6568vvxLiNDS5jhxnLZoIiTceFK5kyouAsm4V1tfESFt6SaHtOTlmrfQJqncoYJfg3CbmKWgo4V26fR56B28X3yAqtClShA-5-EddsNdFeV-xLCV8pR6wHtHeQCMqLrG8becf47xmCg/?imgmax=800&quot; height=&quot;204&quot; style=&quot;border-bottom: 0px; border-left: 0px; border-right: 0px; border-top: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;429&quot; /&gt;&lt;/a&gt; &lt;br /&gt;
&lt;blockquote&gt;
(Exception ex)&lt;br /&gt;
就是当有错误出现时&lt;br /&gt;
将有关错误的信息存入变量ex 内&lt;/blockquote&gt;
如果你要显示有什么错误的话：&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjbtA77XzSiRbjVXYSNmpr426pFvWeP5DmxLyV2RRLBIZ__8ir_nad7Bmrc0Eu-sdSO7lyeA0DtbeIB7smzeYYgFkkFvun-XIo-KzIg8geBGThwqa2Z8vP_nmdfADB7EaEU_mVbFr6puO2x/s1600-h/image%25255B44%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEigx3JCmAS0ASULwTpiOJMKemt8Q7Ruued8Hjx0JW136FiOvAD5WnHrBmCeQVx_c-nrnLBVwLf17s6oimVFdUfykFJlLMerp8FZkE4T-nRfHlaC3cDVbzVbKJyIJSrdDnWowDtl37PBNA67/?imgmax=800&quot; height=&quot;204&quot; style=&quot;border-bottom: 0px; border-left: 0px; border-right: 0px; border-top: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;429&quot; /&gt;&lt;/a&gt; &lt;br /&gt;
运行看看：&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg36P1ABprGBSDrSxME056StzxV6UmBaFvmKhPdI8mkAN1KMYubHZgxLOHX93VtukfQB5qcYbTDw0SEJRhyphenhyphendwtLI6VRl6pAaRizxnynAsGbu8TYFJWpDXmYfccQCywXF9xrKc9wBoPo6tHt/s1600-h/image%25255B47%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjVtsdY3U9wdroGOTJwo2tZWcTQSaKw2-xRpElGRVmKy2CYMm1xVXtR1iw6ncZqFrXHiqJdNp4DNF2BTC6heP-YO-AjLRoivlp2gvr-WXbTB-BcwUn24JNqVpkj6-kOmZY77FWwmvK4y41k/?imgmax=800&quot; height=&quot;300&quot; style=&quot;border-bottom: 0px; border-left: 0px; border-right: 0px; border-top: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;300&quot; /&gt;&lt;/a&gt; &lt;br /&gt;
最后的&lt;br /&gt;
还有一个finally：&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiBa18ozxezoQDSmh9G7ReUE4Y_s6A-T1S_39aBbjvAZfKNKD9C2r31eppKXvrxDL3Z3tlOFxEyavWeCci3AFicWe7TFaPtoMD3_ojgNQBkSz7Ew3oipFDhScn91IYr4U_NLvIGY67GgxmU/s1600-h/image%25255B53%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhQIKH0fglUnrwIkP-cs9kuRbfKWxreLoKahKCuCHRdiZ9U3KIOtJ1Vk2qJBbfeO5nBIkDQD3TV5JtzLcLcc78UTqD6tRJQkptTc4WCNsEZtkfspyRBfEqDvT_0-20rNYa-LO4edtYrhVHV/?imgmax=800&quot; height=&quot;225&quot; style=&quot;border-bottom: 0px; border-left: 0px; border-right: 0px; border-top: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;168&quot; /&gt;&lt;/a&gt; &lt;br /&gt;
&lt;blockquote&gt;
Code body3&lt;br /&gt;
不管有没有任何错误&lt;br /&gt;
Code body 3 都会被执行&lt;/blockquote&gt;
像这个有错误的代码：&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgEPj8WZ9t6PoFtC7yJlsktXzcC8Z13NV_hcR1uXiYQiAVviNrujVZv8eJKP2kLk2ZVXTCPH_eS2on432UiSNSWTiQeSYCVYL27Q_cEcvycP7uWFFUaQlum_XQpQ6weLPQN-ibj5OM0Im3P/s1600-h/image%25255B56%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhXpFPzUjD9SBvKlYJDcnWWxM-7nLUP1CVgzM14uevdjwq6asWet5VPYzUvcyanz6JLdGtBxFOwASJdpNbZemIplg5wtBdzakGJ94toEjaRuCJhAaOI43Eo9grkC1fhfN1x0uhYSFLW0NrF/?imgmax=800&quot; height=&quot;274&quot; style=&quot;border-bottom: 0px; border-left: 0px; border-right: 0px; border-top: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;401&quot; /&gt;&lt;/a&gt; &lt;br /&gt;
运行点击button&lt;br /&gt;
就会出现两个messagebox&lt;br /&gt;
第一个是Exception 的信息&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiWdNLYzdq-wcXCr191j37-S239ZrYz52PSxGPcf1HCnNVYfpzyRFKf3nW7MnW5bqhK6JXBGn2ufJTMFmcX31gSkgMFGRq8yOAUKgxkr0BIny5b9Y_xaKztch0doq5_bLG8uYq2ntTyQ2ib/s1600-h/image%25255B59%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgfshSStioh2uginszsl5XKuh5WhVwYpenENO839vGDbX8VoKPVWi7PxM6DH9-7HVlXyDXACq25-k4U0x6QFwETImE_-p0N_JEs0mC1MlXMn3yWzOHZLqcM9non1TBfEbxK02orwW9BtQ7J/?imgmax=800&quot; height=&quot;300&quot; style=&quot;border-bottom: 0px; border-left: 0px; border-right: 0px; border-top: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;300&quot; /&gt;&lt;/a&gt; &lt;br /&gt;
第二个就是finally 中的 messagebo&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh8mlU9l_oOcgewouTLTp_NjsGidlrbE4Mpp7tZM3_u083rBv7H1WGypH5NEqV7wPy54vIgyGwnesSHjYGiOHvpQDNdMglca2iQPURVWtn8Ueg6mKDHo56XE9o2eZtO8dtzzh1pC9OtWcIo/s1600-h/image%25255B62%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgUAK2nMZt7VyuV4Xi8tAvKMYMo00RLB08xuo7cXe7OHkriJtdpjnJJg3AbVkTPi9LpA3auMv62UXpBA_tZtCIJuEWe5IgnQX5vVYNQVDwOnKUNlGjyBrMNcaLfcEdBZ1afmdRE0fdd_JhB/?imgmax=800&quot; height=&quot;300&quot; style=&quot;border-bottom: 0px; border-left: 0px; border-right: 0px; border-top: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;300&quot; /&gt;&lt;/a&gt; &lt;br /&gt;
&lt;br /&gt;
但是如果try 中的代码没有错误的话：&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhBapMUUpnW9nCF6Me1WDr26tn6m6cV2zPjQPq0fPnEFUd1HxiAW9iK4Uqf8rsJ7Y_lM004XGjERWfkK-ajbOf8fZ1YYZYXbHP5FfiRNj_gLmHCQ28RnSHwtRdLFo5JrrMLWX1ex2HlSKIl/s1600-h/image%25255B65%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhqvVX5HjxSy_V4GzBF48L44BpbIPHUhveGAhp7wfuo3MN07GgyQaryaUQZODmeiefv09_nOmpID_yh3zkD-WKQXSdeXXbq0T1BnSXVyQYAsAaPMT6SdZxcmJ8Grbpnp14NFJWknaSL4nh9/?imgmax=800&quot; height=&quot;264&quot; style=&quot;border-bottom: 0px; border-left: 0px; border-right: 0px; border-top: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;403&quot; /&gt;&lt;/a&gt; &lt;br /&gt;
finally 之中的代码还是一样会被执行：&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgbECEzjTcOnXVcEJfJyvIeFc7noV2zGAvbMruvwkZdhYECSHZyUYiQG8uGeu8bfC2ftrTs8IxjNYNGwJwEPSmxBg0zS2R_-faRd04n_AItBGKKzGToJfekPeS89fEsVnBOL-mvVSsZR4mB/s1600-h/image%25255B68%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg6nqTVCwdWBXMO_7c5qCd77M_C6-BRfwwy-OwKrolHpdTpch8HqgWMAeRxMhSiIuxUD3OhF-Mcq7JDfXjcHmftXalEkb4gYNxMcycWbkNdBp2_xS1PA2UONSaCRKMY6oTlmiTSkN_jgGA6/?imgmax=800&quot; height=&quot;300&quot; style=&quot;border-bottom: 0px; border-left: 0px; border-right: 0px; border-top: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;300&quot; /&gt;&lt;/a&gt;&lt;div class=&quot;blogger-post-footer&quot;&gt;&lt;script&gt;
SyntaxHighlighter.highlight();
var linkwithin_site_id = 1130633;
$(&#39;#toTop&#39;).remove();
$(&#39;body&#39;).append(&#39;&lt;div id=&quot;toTop&quot; onclick=&quot;$(\&#39;html,body\&#39;).stop().animate({\&#39;scrollTop\&#39;: 0})&quot;&gt;Top&lt;/div&gt;&#39;);
$(window).on(&#39;scroll&#39;,function(){
if ($(this).scrollTop())
{
$(&#39;#toTop&#39;).fadeIn(&#39;fast&#39;);
}
else
{
$(&#39;#toTop&#39;).fadeOut(&#39;fast&#39;);
}
});
&lt;/script&gt;
&lt;script src=&quot;http://www.linkwithin.com/widget.js&quot;&gt;&lt;/script&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://garyngzhongbo.blogspot.com/feeds/1149647047022101610/comments/default' title='博文评论'/><link rel='replies' type='text/html' href='http://garyngzhongbo.blogspot.com/2013/12/c-17trycatchfinally.html#comment-form' title='0 条评论'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5319618319979683940/posts/default/1149647047022101610'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5319618319979683940/posts/default/1149647047022101610'/><link rel='alternate' type='text/html' href='http://garyngzhongbo.blogspot.com/2013/12/c-17trycatchfinally.html' title='[教程][C#] 新手入门教程#17——Try..Catch..Finally'/><author><name>Gary Ng</name><uri>http://www.blogger.com/profile/00014057672539539340</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhDQPdybc1riyCZNeVHSnDK1xv9kF70zlz-Mt9xHCggkXCOjcEudHsdp5oTn3JDQbjXYnsPqXFWw6cmCJcS67gPg52Ov9A2ukP61ZsO1JKn7T89cXjy7ugRL-fVKLj_UUnVFuznrOHsM0iW/s72-c?imgmax=800" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5319618319979683940.post-2160758137017443846</id><published>2013-12-01T11:28:00.000+08:00</published><updated>2013-12-01T11:32:53.245+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="C#"/><category scheme="http://www.blogger.com/atom/ns#" term="入门"/><category scheme="http://www.blogger.com/atom/ns#" term="原创"/><category scheme="http://www.blogger.com/atom/ns#" term="教程"/><category scheme="http://www.blogger.com/atom/ns#" term="新手"/><title type='text'>[教程][C#] 新手入门教程#16——Do..While 循环</title><content type='html'>Do..While 循环是 while 循环的变体&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiDmWPI3IWM0zVyVbIvcVIw0EBTpZxJGyyDMRXSgmnuZTzfpHkNurtmvuF0ecW0Xxc-CHhRUuqeCevTZ0eUkr-RdSOPdS5ZWLqKRrzMPyN_aPzDxgo3kv7Ny6NbZn6_9vsz1vOncqBgyrZe/s1600-h/image%25255B11%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; height=&quot;103&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiBx4sYr50DMV6NyTN8dP9EErz3unE4sbEU1TQtPbZ1M7FKeEdF0YIdklIwV_nM8SphMDS_Agf9t75THIsK1fJHJiJssD8eje-VPi2YWXJSvPPgKlav0vUxskXKRKRZ1jK6kBhLsNlrrrWF/?imgmax=800&quot; style=&quot;border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;214&quot; /&gt;&lt;/a&gt; &lt;br /&gt;
&lt;blockquote&gt;
do.. while &lt;br /&gt;
它不管三七二十一直接就运行 code body&lt;br /&gt;
运行了才检查condition 是否为true&lt;br /&gt;
如果是，继续运行&lt;br /&gt;
如果不是，结束&lt;/blockquote&gt;
看出do..while 跟do 的分别了吧？&lt;br /&gt;
你：不明白..&lt;br /&gt;
我：好吧，首先你先把你的手放在滑鼠上，找到你的scroll wheel，然后往上滚，一直到最顶..&lt;br /&gt;
你：（滚ing&lt;br /&gt;
你：然后？&lt;br /&gt;
我：重新读！&lt;br /&gt;
你：降！龙！十！八！掌！（&lt;br /&gt;
&lt;pre style=&quot;background: #303030; color: #e0e0e0; font-family: consolas; font-size: 13px;&quot;&gt;&lt;span style=&quot;color: #40c4ff;&quot;&gt;for&lt;/span&gt; (&lt;span style=&quot;color: #40c4ff;&quot;&gt;int&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #eddac0;&quot;&gt;i&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: silver;&quot;&gt;=&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #ff80ff;&quot;&gt;0&lt;/span&gt;; &lt;span style=&quot;color: #eddac0;&quot;&gt;i&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: silver;&quot;&gt;&amp;lt;&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #ff80ff;&quot;&gt;18&lt;/span&gt;; &lt;span style=&quot;color: #eddac0;&quot;&gt;i&lt;/span&gt;&lt;span style=&quot;color: silver;&quot;&gt;++&lt;/span&gt;) { &lt;span style=&quot;color: #eddac0;&quot;&gt;Me&lt;/span&gt;&lt;span style=&quot;color: silver;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #eddac0;&quot;&gt;Slap&lt;/span&gt;(&lt;span style=&quot;color: #eddac0;&quot;&gt;You&lt;/span&gt;); }
&lt;/pre&gt;
&lt;br /&gt;
）&lt;br /&gt;
&lt;br /&gt;
好吧好吧&lt;br /&gt;
&lt;br /&gt;
先来看看&lt;br /&gt;
&lt;br /&gt;
这个while 循环&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg8gdkIcjuV4UIeaks0zr5HUay0olI4Ey-ekr9d8CQjBi89zs0XdyTohF3V0T530dG_-loz2zDrmF8vSHwmrTVjnAUBNCnEkq7T7j_AVgg_pC-tWpkgIIxcT40xoFYLD_IhCuvR5iGDNAoP/s1600-h/image%25255B5%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; height=&quot;157&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi0JOwHw7uFVyNQZZptCrMdeLZXFeYoyoDsFnPksp26Ta3fk66JOpMEJLx9z2FTY86xGcI3aaXFRDaR6wO3_PGQ0QfrspvFYJuCYP6_L_fSYq0xmDWTS2CKLBeKoGDIVIlxgYf2rIcYOwOU/?imgmax=800&quot; style=&quot;border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;413&quot; /&gt;&lt;/a&gt; &lt;br /&gt;
&lt;br /&gt;
运行的时候，你会发现没有messagebox 跳出来！&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjXXiOPx1_YfCF_H14sP3C1yXXqzg9i-Wibl3I3Aop-fSyeGjmX0uC_Ct1QFY2v8Vo3SxQ1QcYC7uwAsxx-m16nk_LxOvvtst5EJ7MsXXKzGIV4YxkXHxryVeRjIaJOrBtCJQ1V3KeKNKa_/s1600-h/image%25255B8%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; height=&quot;350&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgQLFANCIADPLvy2fApwuD9b7eZm6WHkL8uIXP4oOU4SFRYP9ibLFaAvP9mFh51MYDd9e12pJJgN0eQP_clnbN6m5V8wfCIbZU58uJdDykiBDStvlslpyLrJ457TsERpY0KqPTfG5FdfO4d/?imgmax=800&quot; style=&quot;border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;335&quot; /&gt;&lt;/a&gt; &lt;br /&gt;
&lt;br /&gt;
为什么呢？&lt;br /&gt;
&lt;br /&gt;
&lt;blockquote&gt;
&lt;br /&gt;
因为 while (i&amp;lt;10)&lt;br /&gt;
&lt;br /&gt;
可是i 表示&lt;br /&gt;
&lt;br /&gt;
&lt;blockquote&gt;
&lt;br /&gt;
我已经是10了&lt;/blockquote&gt;
&lt;br /&gt;
所以 i &amp;lt; 10 这个condition返回false&lt;br /&gt;
&lt;br /&gt;
然后while 就不会执行了！&lt;/blockquote&gt;
&lt;br /&gt;
如果写成do .. while 的话&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiOW9_Vax0TxYrOZ8P8AdMfvicBx83hZWFzJsD6cS_QahgPhztOnyZaki86JcdkL3XyybZhbTUoQhg3GPxCxh1Wj-weonH_kFPBqAt0yZyytEYVTM7pxSet4mV2sO3YB5eyGBD-tIpyd9lj/s1600-h/image%25255B20%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; height=&quot;160&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjNjAOAvzXkWGN-KYS7abT9qRORPapSs6VZjMSJOTqR8-CT7yrlgBcCsh5xaiV_pAASCvI3ZRKU6VXvbaTyOQUawEXUM2_Ckc48cDgW0RCs9RMjuF-95EiGjdQPjm1Uy4_tCKiHJ_5TFdjJ/?imgmax=800&quot; style=&quot;border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;410&quot; /&gt;&lt;/a&gt; &lt;br /&gt;
&lt;br /&gt;
运行的时候，messagebox 却弹出来了&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjq0yPoEupi_lpGv2rrBGLz5WSEs490B-xGw3cxAt1dmTn8WpRZqk6geO5DOB16OPzmWnt73iMn6wu6w9SKkChottzhg8NreqU5Y7DtX9Tyc2cDdu-G-RbyHCPSswbGbFaBWZukAMY1x-y7/s1600-h/image%25255B17%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; height=&quot;350&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi0alDBia54UlK85S_PXFSwNfsMQtZWg8Y3VMQGyS2hSLDk3Zgyqf09zw2NFmw6zSQPEj91o1JWYAZIAPzUuBro7qA0Kped1w61iS8_9CiseQ-pWjmDfi3TY-LOCuSrRX6gTla3XMuRWMdi/?imgmax=800&quot; style=&quot;border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;335&quot; /&gt;&lt;/a&gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
为什么？&lt;br /&gt;
&lt;br /&gt;
&lt;blockquote&gt;
&lt;br /&gt;
while 在第一次循环的时候&lt;br /&gt;
&lt;br /&gt;
不会检查任何condition&lt;br /&gt;
&lt;br /&gt;
它会直接执行&lt;br /&gt;
&lt;br /&gt;
然后才检查i 是不是小于10&lt;br /&gt;
&lt;br /&gt;
int i = 10 &lt;br /&gt;
&lt;br /&gt;
所以i &amp;lt; 10 这个condition返回false&lt;br /&gt;
&lt;br /&gt;
do .. while 就：&lt;br /&gt;
&lt;br /&gt;
&lt;blockquote&gt;
我该停止运行了 &lt;/blockquote&gt;
&lt;/blockquote&gt;
&lt;br /&gt;
你：无限循环呢？&lt;br /&gt;
&lt;br /&gt;
我：你要做什么？&lt;br /&gt;
&lt;br /&gt;
你：嘿嘿嘿…&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjzb-ehiK7lBpg6YK2VhkIL-DG-8KBOwbosg_IjRPFc9BnbXorzV-4uuiL5cyzVkyZrM3gDHrnOI0MOaOG9dHvrIVjfa45ZwNPu9_h65LamFXFi_Sap0Tig_ZE27QXBi3gxxvxodKENlhmp/s1600-h/image%25255B23%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; height=&quot;140&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhqZLAdLzKgWwj3za8Ry-FkpGWM41sXz1c6Om1dO6p7-wMEr5L0XtpsxDroo9IBT9DXxaYiQn2KJ5sZONFKiipXHSkmm0uTsXPt0SK5hggjJo53McOPoexdPJvMBFyYnDTiU19QI21scN9y/?imgmax=800&quot; style=&quot;border-bottom: 0px; border-left: 0px; border-right: 0px; border-top: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;406&quot; /&gt;&lt;/a&gt;&lt;div class=&quot;blogger-post-footer&quot;&gt;&lt;script&gt;
SyntaxHighlighter.highlight();
var linkwithin_site_id = 1130633;
$(&#39;#toTop&#39;).remove();
$(&#39;body&#39;).append(&#39;&lt;div id=&quot;toTop&quot; onclick=&quot;$(\&#39;html,body\&#39;).stop().animate({\&#39;scrollTop\&#39;: 0})&quot;&gt;Top&lt;/div&gt;&#39;);
$(window).on(&#39;scroll&#39;,function(){
if ($(this).scrollTop())
{
$(&#39;#toTop&#39;).fadeIn(&#39;fast&#39;);
}
else
{
$(&#39;#toTop&#39;).fadeOut(&#39;fast&#39;);
}
});
&lt;/script&gt;
&lt;script src=&quot;http://www.linkwithin.com/widget.js&quot;&gt;&lt;/script&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://garyngzhongbo.blogspot.com/feeds/2160758137017443846/comments/default' title='博文评论'/><link rel='replies' type='text/html' href='http://garyngzhongbo.blogspot.com/2013/12/c-16dowhile.html#comment-form' title='0 条评论'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5319618319979683940/posts/default/2160758137017443846'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5319618319979683940/posts/default/2160758137017443846'/><link rel='alternate' type='text/html' href='http://garyngzhongbo.blogspot.com/2013/12/c-16dowhile.html' title='[教程][C#] 新手入门教程#16——Do..While 循环'/><author><name>Gary Ng</name><uri>http://www.blogger.com/profile/00014057672539539340</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiBx4sYr50DMV6NyTN8dP9EErz3unE4sbEU1TQtPbZ1M7FKeEdF0YIdklIwV_nM8SphMDS_Agf9t75THIsK1fJHJiJssD8eje-VPi2YWXJSvPPgKlav0vUxskXKRKRZ1jK6kBhLsNlrrrWF/s72-c?imgmax=800" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5319618319979683940.post-109281127706657560</id><published>2013-11-29T16:14:00.000+08:00</published><updated>2013-11-29T16:14:39.658+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="C#"/><category scheme="http://www.blogger.com/atom/ns#" term="入门"/><category scheme="http://www.blogger.com/atom/ns#" term="原创"/><category scheme="http://www.blogger.com/atom/ns#" term="教程"/><category scheme="http://www.blogger.com/atom/ns#" term="新手"/><title type='text'>[教程][C#] 新手入门教程#15——While循环</title><content type='html'>跟for 一样&lt;br /&gt;
while 也是循环结构的一种&lt;br /&gt;
但是他只是检测condition 是否为true&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhP-u_mlBF8jkRJsCLpOnwJ4KlWdYOTk_Rf5hZPLUHFZbgR0b9EnM9lV7GBod17Q3rmxeBXOvSlG4HzxgBI9vWpx-JQFZxMa1-iaJdtsKmjKHokXvQYyE739EHYX_fXFKYCL9-_t6WrxBvz/s1600-h/image2.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; height=&quot;88&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh7lCHqS_7Z-LNaYWja9CglcjSkmWLm0tZqsfim3risBmg65g-lT-x8i0JjB99-uMoj5UcwhJOSU9fSxbzqFoLIaHk8bXn5W7D1Jt6kKT4dGZaXqurMLd8MEnsgWYhHliVvyB6-9qFN1c0i/?imgmax=800&quot; style=&quot;border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;191&quot; /&gt;&lt;/a&gt; &lt;br /&gt;
&lt;blockquote&gt;
condition&lt;br /&gt;
每当while 运行code body之前，它为检查condition是否为true，true 时执行，false则不执行&lt;/blockquote&gt;
比如说这个for 语句：&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjlKHlV4GHbhpV62C6smUqldLQQct1-bARU4zVhb_20DhR7yw1tSpt4dShjVmynWYr2-4gD2NjVqTgmmmC27Wk8o-OWGxOQOJ1kt4-rd1buqW6dgfzRdFHqPrU3TwUCH7QN0GT0Yfghz0ri/s1600-h/image%25255B3%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; height=&quot;118&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhNVhvixJGWtp57d9wK5f6KDdUJvFfEIZgcnocliRl0fdtwc6oFSGrBgrwK2p6QXrlKLRUBxQ76Paa6asEdQ3kIrBQgmUVtEkGUb_SbTgLxoaXbOPtII-CefLgkLUa7xplZcMokqCO9-aCE/?imgmax=800&quot; style=&quot;border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;401&quot; /&gt;&lt;/a&gt; &lt;br /&gt;
运行结果：&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEimTlSY_EDXgM8gz-8BYFAf5ivlCZ1b2d-DiyRNAk9BX0QJ-M3ky9PLYgZ95Rjom09Wh2MaIrUCo2Bqsf6oTsq5dKjWz1eyiz4AglOqYWF4Lu9IzH-yzRXfg2PAWGOO4Jl8Ug89MG8ST9-W/s1600-h/image%25255B6%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; height=&quot;300&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjk8rtgxZSr9sablZW4QlKTWTnxwom6XGyUAoCiqyLmGiFxydj4t5s-geeC0LD5ze6Nv-gxAxVAtKBzhxKx0TFMVjoEVduYZBK7XQSUyJe9qvT4cOe2bSmz2A8XARiMNaiyryNvXaQhsNVL/?imgmax=800&quot; style=&quot;border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;300&quot; /&gt;&lt;/a&gt; &lt;br /&gt;
转换成while 语句的话：&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjgk437g-CeVf-OYxwRZAUoohnOf4q5YUD4PGtyEUNEpxZ1y08BEZVplS3dArKl6evjd3mrZR_E1GXBCFqH2PZwXdH6xKW47KfV8zsgVpyks5RA0hLgYeKcad2yoLUSeuOsfPeyWy7t3B8W/s1600-h/image%25255B18%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; height=&quot;163&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjFonB7TrhhgbnsPEycebYpU6D-ccDoeESvAS2wePemk8T12vdHfE4ikacZEiL3Zm4MwVgXY6h3_5DSO9d07N5CNNqQauPgki13jXXg-BnHPUPfcjx9Mn5FWKIQfnqsuJS_JjlCrwTWSJac/?imgmax=800&quot; style=&quot;border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;399&quot; /&gt;&lt;/a&gt; &lt;br /&gt;
输出结果是一样的：&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhFEaIH6A2LgW19cNl6E_7Rk4GITzsEC4_bsDwIxJ8Gv4uen6TKzeHOuFPdCaGdRkiS9Oy1rlP5RDCCHueGnKxLcGHye5cUKQyIHDwo3xwaaX4C6hA-sn9brJnZDTJFO2S6LuqWxQl9fMk3/s1600-h/image%25255B21%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; height=&quot;300&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgNWpGio3uQCvj7aFLHkBOF-glgD-81QIOHHkKm1_xDVYZyRDZ5qxSGkOtIxXGBBB0Xt5iMYxjvz_Hewn0ILzxniN0vkJ2E0hcKM1LPvu-wzIdyUSq4_1oI7NM3xSftCGkipZQnxFyCr26L/?imgmax=800&quot; style=&quot;border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;300&quot; /&gt;&lt;/a&gt; &lt;br /&gt;
整个代码基本上就是：&lt;br /&gt;
&lt;blockquote&gt;
检查i是不是小于0&lt;br /&gt;
如果是的话，运行代码，i++会让i增加1&lt;br /&gt;
如果不是的话，退出整个while循环&lt;/blockquote&gt;
&lt;br /&gt;
当然还有一个就是用 break 语句：&lt;br /&gt;
（还记得break 是干啥的吗？）&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjSJnO96lop16l3K_qSxS2yK-26NHMBiftTi8dS-Ok5_HJ0YYoqMQsALFUKjnfuCwQPR9ZLzI4lga-VxbHp_72pUpyhH_IersGXc69aIO9V8RNRfRkNRrBAjAHW50HatYAQ2hNQ_QyRFkDV/s1600-h/image%25255B24%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; height=&quot;217&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjiVyKq0Puuv9TcuT76aTE4BJB8sJADsYoeBTYlr7RgUf4AsNgBrBoqF8-Z5xxLdJT4AksSRDM90Axb5tIy7kUTzq3ulR6Ejb0yGusLXPqESVQxhlS-V_D5IXXR7HZa4xqQEQD-3RjP_D3G/?imgmax=800&quot; style=&quot;border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;409&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;blockquote class=&quot;bq_warning&quot;&gt;
注意：记得break！不然while 会疯狂的！&lt;/blockquote&gt;
输出结果：&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhj9ay21Um3I_7u1ssl1Q8WwlXKdD_-9E0ryG5fTr7Q04BtQEgLa1SNsA8g_KRC0gaHbZuLohN2esQVUi-E8ZcxuI4-C-g1ueppCDOVDUdycZcy1ZJuOnRUAy0mKaPFZcR0QA6aOnnh1uEO/s1600-h/image%25255B27%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; height=&quot;300&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg2nwPIazwbgpxIO0g8Z1J5YyQJYNBf6RFIHN2_ed3u5bM497jSJ5zF_VAicz26iq7rJQDK82TJk3dueNgk8aUb7bCw56tidfFM6VY8Lt1-Dc_f40-rMXZkLRdeP597zLPSu2Ytfw-10nJr/?imgmax=800&quot; style=&quot;border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;300&quot; /&gt;&lt;/a&gt; &lt;br /&gt;
while (true)&lt;br /&gt;
代表condition 一直都为true&lt;br /&gt;
所以while 循环一直（都很疯狂的）运行着&lt;br /&gt;
当i大于9的时候&lt;br /&gt;
break语句就会（很理性的）告诉while：&lt;br /&gt;
&lt;blockquote&gt;
喂！你该休息了！&lt;/blockquote&gt;
于是while 就休息了…&lt;br /&gt;
你：你在写故事吗..&lt;div class=&quot;blogger-post-footer&quot;&gt;&lt;script&gt;
SyntaxHighlighter.highlight();
var linkwithin_site_id = 1130633;
$(&#39;#toTop&#39;).remove();
$(&#39;body&#39;).append(&#39;&lt;div id=&quot;toTop&quot; onclick=&quot;$(\&#39;html,body\&#39;).stop().animate({\&#39;scrollTop\&#39;: 0})&quot;&gt;Top&lt;/div&gt;&#39;);
$(window).on(&#39;scroll&#39;,function(){
if ($(this).scrollTop())
{
$(&#39;#toTop&#39;).fadeIn(&#39;fast&#39;);
}
else
{
$(&#39;#toTop&#39;).fadeOut(&#39;fast&#39;);
}
});
&lt;/script&gt;
&lt;script src=&quot;http://www.linkwithin.com/widget.js&quot;&gt;&lt;/script&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://garyngzhongbo.blogspot.com/feeds/109281127706657560/comments/default' title='博文评论'/><link rel='replies' type='text/html' href='http://garyngzhongbo.blogspot.com/2013/11/c-15while.html#comment-form' title='1 条评论'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5319618319979683940/posts/default/109281127706657560'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5319618319979683940/posts/default/109281127706657560'/><link rel='alternate' type='text/html' href='http://garyngzhongbo.blogspot.com/2013/11/c-15while.html' title='[教程][C#] 新手入门教程#15——While循环'/><author><name>Gary Ng</name><uri>http://www.blogger.com/profile/00014057672539539340</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh7lCHqS_7Z-LNaYWja9CglcjSkmWLm0tZqsfim3risBmg65g-lT-x8i0JjB99-uMoj5UcwhJOSU9fSxbzqFoLIaHk8bXn5W7D1Jt6kKT4dGZaXqurMLd8MEnsgWYhHliVvyB6-9qFN1c0i/s72-c?imgmax=800" height="72" width="72"/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5319618319979683940.post-2564887025546387180</id><published>2013-11-28T14:15:00.000+08:00</published><updated>2013-11-28T14:15:21.682+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="C#"/><category scheme="http://www.blogger.com/atom/ns#" term="入门"/><category scheme="http://www.blogger.com/atom/ns#" term="原创"/><category scheme="http://www.blogger.com/atom/ns#" term="教程"/><category scheme="http://www.blogger.com/atom/ns#" term="新手"/><title type='text'>[教程][C#] 新手入门教程#14——Foreach遍历</title><content type='html'>你：快说！我要怎么样直接一个一个访问我的students 数组！（亮刀&lt;br /&gt;
我：用For..&lt;br /&gt;
你：我不要For！&lt;br /&gt;
好吧，既然你不要For&lt;br /&gt;
这里还有另一个循环语句：Foreach&lt;br /&gt;
&lt;br /&gt;
如果你有一个数组：&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjYLf4Cv9owkwL6wjPGZaNltYCvfP5F714VBeqMYuOvDtUlIFFbbfMyTZCa8fkcjDRcUkpcd_ndKPXKa6TBTZGjpFVtPksmbVttHUMXYjYH9YQP32fgmd6iGPDgc-OcYUUqcloD27co1kGn/s1600-h/image%25255B2%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg9iwlDA6AUjQlOcui80uHFcQrivUTnGffce910nal6ynGRz3WPKYm3jT-Ipf-jzFTjxCCp8nk2kuV-33RoHUPT2O3_awWs3y-4kwFLHfQ8kPO21Kgtd3rQ0dD2BcN3Nib9T4UJtJc_I9eq/?imgmax=800&quot; height=&quot;100&quot; style=&quot;border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;431&quot; /&gt;&lt;/a&gt; &lt;br /&gt;
如果用For来遍历整个students 数组的话：&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh9_H_5QyHstA0d6VjEakk-hqDHr9dPERPCSNoUho7GYlrp40jJLvAs-lIKWXaYQIZJX7bSeuJGzn5fkWqBCKiD772k-j2_8w1r_u5a4nYJin8oj8WNqiQjAwIcrq512c0qoggkUxMBr16M/s1600-h/image%25255B5%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgDa4DznXUFPjOlPn-kXmLaaeECJ4P0F8JWc2Mvld-AY8dTlwRKw6Hl1J0Cz8x3xLdUVEbBtCw-rSRLVgDqZDyg02Tv78xBTPeYrCjmgF2RlFdKyD7V3epW9-fBfRoZo-k3XMgz0HDzSlhO/?imgmax=800&quot; height=&quot;139&quot; style=&quot;border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;429&quot; /&gt;&lt;/a&gt; &lt;br /&gt;
输出结果呢：&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgOfuko-hBTRsVtmLJjizbso2AoWqW31QyTAnlvqZSK3IHH-tqVNiysy3hNTXDVa3ZWd7Gxt4FR2pJBTpfaxtWoztroWnBW5Du6M74rAG3jeQ8p2mj2mCmhSNW1lkNhMgrgIwEMs_LCv_VJ/s1600-h/image%25255B8%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgApKKpYOlr3s6V67XbCQZ6pJd065Pi2n2IrajfpCNZd7aFAN-3XYhBmU6jjoFQRcfs7ijFYL1r9IaVTPtRmmTx_I4jY2se3__pVr8MXoUKNgHdU49c-714ErjW9qqhcUZYDGkmLhQ6ha66/?imgmax=800&quot; height=&quot;330&quot; style=&quot;border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;308&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEixyynYWUDrU1Yqj-s5a-BLKN6HObLHPXxyrqWLVNDQsRvJ_IuqEwguaH62wA0fJhIMpH1Jo8Y7OY659nUt6UNJLUYGaq1J-XkOo01GHXSkA9cHq6MSbY5mlLKmfccKH-gcc525rk1tbBZG/s1600-h/image%25255B11%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj7IT_5g5ptdvPIK3bX6Gopd5YEKVxTXsey92rFEW-vA1LD0uAmGUl9SmwDMsWnoIdCzXOUFc9QfTCjAWy_-Hr9o2sYU55j-R5AVZPPiXVUPc96j2CTl3I-YDcVPnYNBkwBKRKpRbGH6upV/?imgmax=800&quot; height=&quot;330&quot; style=&quot;border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;308&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjcblbySmx87klZ6KpPOakB2QS9JofrW8jG8j1MbHeJ3cKyp1Lme15Ly420XKdhVoxzVOrOuk1hKz7TMC5Qhf6UUXal5gVNGHm-iEUIZh2ibdPXcuUdUC-O4l4I9PDokrcGhCg4q_cCqxX0/s1600-h/image%25255B14%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjpFbx1KSM8TuJtEKL75APHKFaEQilvMFcOSxNbf2xozxnXB0F5DiWn5LZ7IiY7pREYjR0U2NgnlL-oI-_Ko-Q0wbsz4WVFTlSuGfITanml-KXtLKuGSGAU-AaTgnatuU-GRw4qsRPtWdWg/?imgmax=800&quot; height=&quot;330&quot; style=&quot;border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;308&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgAGqpqTjFp-EvMVP6f1K2gGYmQoPBngKsqgJn5X2_UIvwZQsF0NUuWvzHrhhQVFxBfnG895R1EMbiECyiOK1MGXXlpRqdS7W1_-FCgFTvyL7tQ0onHN5-KAe7Fxi7cHu9IltqYiJM4I_sJ/s1600-h/image%25255B17%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEii87EfCcY8UGNy8QxlmyBUa_LS03VPneSjFo6n5yFmsputRxJn13lqSkgI60CUmagJJSbtJTtYTaR24QT-J9L1vjTbE_fOfy4YO-GS-AqkTz_F72u3Ey7_fyost79cW3T7ozlFKLJFtayu/?imgmax=800&quot; height=&quot;330&quot; style=&quot;border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;308&quot; /&gt;&lt;/a&gt; &lt;br /&gt;
&lt;br /&gt;
&lt;blockquote class=&quot;bq_warning&quot;&gt;
注：看到students.Count() 了没 .Count 是一个属性(Properties) 但是 .Count() 是一个方法(Function) ；每一个方法都需要加一个()，不管他有没有参数&lt;/blockquote&gt;
你：我的Foreach呢？&lt;br /&gt;
我：那个students 中每一个元素是什么类型的？&lt;br /&gt;
你：string!&lt;br /&gt;
厉害！&lt;br /&gt;
foreach 很简单：&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjigzBisQ0f-heqenw5as9XfridW6kNm_5zwgVD27npSa4cjp0XMN9lg7xnlxF8DnY1wkvdfBEx4RUrMXwrgCkRcSuWANs1Rai0mSM72fdzqv1mzTTcd-c18GYSj1_CC8Hgs3uQlmU8GMDV/s1600-h/image%25255B20%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEixTUu7gH2gs9R5LBOe7yGwDcvNUmWFq3p7h6gGQATIfAGaOwFyQuYAPXgXuSCl12NrjIoXhRmgFSRbXTWJobuCfwUR2C7bJOKiQqPLINEKphx4JJYiRrbFriZnrIOXWeq6U4e9AuRaLILP/?imgmax=800&quot; height=&quot;91&quot; style=&quot;border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;372&quot; /&gt;&lt;/a&gt; &lt;br /&gt;
&lt;blockquote&gt;
variable&lt;br /&gt;
就是当foreach 从another variable抽取一个元素并将其储存到variable 之中&lt;/blockquote&gt;
&lt;blockquote&gt;
another variable&lt;br /&gt;
就是要让foreach 遍历的变量，他可以是数组、也可以不是数组&lt;/blockquote&gt;
&lt;br /&gt;
既然students 里面的每一个元素都是string..&lt;br /&gt;
你：（抢话）那就代表variable 是一个类型为string 的变量对吗？&lt;br /&gt;
我：对对对！&lt;br /&gt;
你：（又抢话）那another variable 的部分就是那个students?&lt;br /&gt;
我：对对对！&lt;br /&gt;
所以代码就是：&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjiRvd7rog4PYVR9V33VERE6gW0o8YVFylMzjP0XfhdDHY_6bH65zTdtlKy7IOLq7WUYAVA8aekBlMsTu8tmEZGLwH5JKbUeLdvdOd0r3DAwUOTgGeoiZRchXv57SGxjsShf8cqqMmDYq9W/s1600-h/image%25255B23%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiFBmOokXYuUoSOrbzmEyn7R-_PrMnDAQGzVQqw0_HzWGnBI0n_95f9jor43hBiBo18Lle8ADGakwspazovZe09kgVRyiL-5zRvROkcjIVtMIDJZ51B3npRQRJtu4LL_3imrKV2I2nkVUBD/?imgmax=800&quot; height=&quot;146&quot; style=&quot;border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;425&quot; /&gt;&lt;/a&gt; &lt;br /&gt;
所以输出结果是一样的：&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgOfuko-hBTRsVtmLJjizbso2AoWqW31QyTAnlvqZSK3IHH-tqVNiysy3hNTXDVa3ZWd7Gxt4FR2pJBTpfaxtWoztroWnBW5Du6M74rAG3jeQ8p2mj2mCmhSNW1lkNhMgrgIwEMs_LCv_VJ/s1600-h/image%25255B8%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgApKKpYOlr3s6V67XbCQZ6pJd065Pi2n2IrajfpCNZd7aFAN-3XYhBmU6jjoFQRcfs7ijFYL1r9IaVTPtRmmTx_I4jY2se3__pVr8MXoUKNgHdU49c-714ErjW9qqhcUZYDGkmLhQ6ha66/?imgmax=800&quot; height=&quot;330&quot; style=&quot;border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;308&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEixyynYWUDrU1Yqj-s5a-BLKN6HObLHPXxyrqWLVNDQsRvJ_IuqEwguaH62wA0fJhIMpH1Jo8Y7OY659nUt6UNJLUYGaq1J-XkOo01GHXSkA9cHq6MSbY5mlLKmfccKH-gcc525rk1tbBZG/s1600-h/image%25255B11%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj7IT_5g5ptdvPIK3bX6Gopd5YEKVxTXsey92rFEW-vA1LD0uAmGUl9SmwDMsWnoIdCzXOUFc9QfTCjAWy_-Hr9o2sYU55j-R5AVZPPiXVUPc96j2CTl3I-YDcVPnYNBkwBKRKpRbGH6upV/?imgmax=800&quot; height=&quot;330&quot; style=&quot;border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;308&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjcblbySmx87klZ6KpPOakB2QS9JofrW8jG8j1MbHeJ3cKyp1Lme15Ly420XKdhVoxzVOrOuk1hKz7TMC5Qhf6UUXal5gVNGHm-iEUIZh2ibdPXcuUdUC-O4l4I9PDokrcGhCg4q_cCqxX0/s1600-h/image%25255B14%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjpFbx1KSM8TuJtEKL75APHKFaEQilvMFcOSxNbf2xozxnXB0F5DiWn5LZ7IiY7pREYjR0U2NgnlL-oI-_Ko-Q0wbsz4WVFTlSuGfITanml-KXtLKuGSGAU-AaTgnatuU-GRw4qsRPtWdWg/?imgmax=800&quot; height=&quot;330&quot; style=&quot;border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;308&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgAGqpqTjFp-EvMVP6f1K2gGYmQoPBngKsqgJn5X2_UIvwZQsF0NUuWvzHrhhQVFxBfnG895R1EMbiECyiOK1MGXXlpRqdS7W1_-FCgFTvyL7tQ0onHN5-KAe7Fxi7cHu9IltqYiJM4I_sJ/s1600-h/image%25255B17%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEii87EfCcY8UGNy8QxlmyBUa_LS03VPneSjFo6n5yFmsputRxJn13lqSkgI60CUmagJJSbtJTtYTaR24QT-J9L1vjTbE_fOfy4YO-GS-AqkTz_F72u3Ey7_fyost79cW3T7ozlFKLJFtayu/?imgmax=800&quot; height=&quot;330&quot; style=&quot;border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;308&quot; /&gt;&lt;/a&gt; &lt;br /&gt;
&lt;div style=&quot;font-size: 7px;&quot;&gt;
*其实我不会告诉你，这4张图片跟上面的4张是一样的 xD*&lt;/div&gt;
其实不只array可以用foreach&lt;br /&gt;
List也可以：&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgcX4woI31vhbH4doIinpi9DOYs09MY8DM9rL7v75mVBr2qBD_hB2dYmM-4M3FkDCkHlmmNDl6JiuVBWSgmUBePbbWgSpc_ogyv8Ha9Zib2_PM-89G0mfynEqhWrQcU-V_7Ot2NlYN0LrLt/s1600-h/image%25255B26%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEijl27rH6GQsTLypTAun1_Hi8NHOFdTydm-IzRt3ed1gmyPlhCGrER4e4EChQ8iDDLEEZyaNhBo9p7uoJk9aRAk68RIi9ncpkli1iTsuRaBRqKKQaNujf_hvZinx18eXJaozowcyRrKBJfk/?imgmax=800&quot; height=&quot;139&quot; style=&quot;border-bottom: 0px; border-left: 0px; border-right: 0px; border-top: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;619&quot; /&gt;&lt;/a&gt; &lt;br /&gt;
好了，就到这..&lt;br /&gt;
你：等！别走！（拉&lt;br /&gt;
我：啥？&lt;br /&gt;
你：如果我要遍历一个string 里面的每一个字呢？&lt;br /&gt;
我：string 里面的每一个字叫啥？&lt;br /&gt;
你：char！&lt;br /&gt;
我：所以该怎么写啊？&lt;br /&gt;
你：..不知道..&lt;br /&gt;
我：汗..&lt;br /&gt;
这样啊：&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi0hnHFq4zZKW7e8mkjaXiy5NMmP2ePF70xgBZ62EUre4X3yU3f1Y5n1ICt137xjxEGpM_tQkZyxCxcArzNixdVCMSDL8bcAJOfdoI4P5fokRWGIE67w3XiejrusRjuGsIaUZVYob6lPETz/s1600-h/image%25255B29%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg_1NBKOYUhfbhiIJ3x6PWO-q35FwNXx7YdAxHLGiqViOGjL5rXWRiOWEZqvTTKN0du3L5wOdOzF7zDItcbh28jRE8pKLZknShR3lQyc0HyTAiZ3GXsA-RQSJ4FpptjgR42uxW4d6iMzOtr/?imgmax=800&quot; height=&quot;141&quot; style=&quot;border-bottom: 0px; border-left: 0px; border-right: 0px; border-top: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;413&quot; /&gt;&lt;/a&gt; &lt;br /&gt;
结果：&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiDazepkdRTDEPMhTQjUcdB84GmJY6DbQOLr6TfqEIdp2Fkz5WP4z-olR8Ehj_1CA7Fwm67uhzT3F0B5Fp5d8PYOMHd5Lh8IR7k2XniEmG6580b8DycD-RSahRuRjp2Fx5mECoRWuxLCJM8/s1600-h/image%25255B32%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg9aeQIvnwKmFnARIIDmMP7CaY1xipSnWvQYro2w_d9f6I3gbuSrfT1dLZHDJjyuJMZ26M4emh4roLJ3Z3mdggoUTBKEzjs-kKKCyg7nPKVxKQVnMMj1uY52ReNc7-sMmTh-qMVlgF7MMZV/?imgmax=800&quot; height=&quot;330&quot; style=&quot;border-bottom: 0px; border-left: 0px; border-right: 0px; border-top: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;308&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjLFgeRi8heixXokxrG4-B9i07gWaed11RXe9Ysq94uIR2u35aSQCUMGApsZ4Tda4PUpGMMvYivZBU8OvCmPmK6vd9RdRGwAy5gbI71NP9bKIhEIDc2QlZf0_YPeQpdkc7W1op3YhHPIMb-/s1600-h/image%25255B35%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjA7uSXTBWjXRKnP4ubgadXrvsRacINkgkn9fvzTca-MkJ03jDp1pQ3C642Awb0HNM_3muWUVNKpl4I0gqotpkyeaqbcj5ujR-nqw9XsDM2oBUHhrdMSTpmO0GlrOBYBxi5lArSFb_NmIPK/?imgmax=800&quot; height=&quot;330&quot; style=&quot;border-bottom: 0px; border-left: 0px; border-right: 0px; border-top: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;308&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjPC40mMPoItxlv8nB0RcS6JXxYq_yXZZK0z2DG2heIsbCqJzbYglW6tev0kES4q-Ft_Y25OesUoCRNT3ZNwYb03MsORNwS4hDkC4Dvu7K_Y4KlPGfJMND6YRk0xCNFtB4Id7LqI-n0r5s1/s1600-h/image%25255B38%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEieazKGtG2t4iJAMqbPEZeoJ2AYSdZolQ-jVjOiY7V42HFwxURo4vHLB1imStNclKH9La7UcqcHZN8f82bf7qncN_V039zPlahS7uP8Z8JSYFdqcacTdgbWARs-nqk0W_MtWCzIxpEE_TMW/?imgmax=800&quot; height=&quot;330&quot; style=&quot;border-bottom: 0px; border-left: 0px; border-right: 0px; border-top: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;308&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjvYv4k1qQKDAdoY99RvqJpqczILj8s2icA1Nf5pyxTdaLTqCofjyxEEa8PEh_N0EcQbKZrMfUOVpGMGOc3nz5t7amQQU4oZEgJAydAVkndjAwPulql1CpZKjCVQULsYutnLprTwJHYXufU/s1600-h/image%25255B41%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg1CaAa_JcHD5c5Ms6RDISFLTD0x_kxyPS-AmsQs56C1R0WTlVCvISMgGdnWY9CalYDjukpZMd-hnbf6gLmOljO9lE5TJVLW_wQScd81M8QyQv0foegynuRmXIL2Uf4MzVFmj5i5Ec0yGWc/?imgmax=800&quot; height=&quot;330&quot; style=&quot;border-bottom: 0px; border-left: 0px; border-right: 0px; border-top: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;308&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgVYDqTEsPHvNzzZL0gehnAI9Dg0XgShHZBweKp5Okn1ux4_PrJUxfP1atL7z2H2TXfe9t2Bj8NVV5njqTWcoj79oKuwKwk14zPvXYMeIGXioqgfrA0QWiAP8Yt9VCvrmU-uBFYl-d8Jrhyphenhyphen/s1600-h/image%25255B44%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg2NFVwTyWtsM2XfY_ocGoRXUDWGtuoh7DzRySml4IujBJhT8OmgYsXEpA68X7cA_zYtYucFVyufu4ddpqnr4ihiBcq2GJBn3dwdaihq8o6g8adOd4d3srB3o0V0EXSjf5Fnra81RHmjaBd/?imgmax=800&quot; height=&quot;330&quot; style=&quot;border-bottom: 0px; border-left: 0px; border-right: 0px; border-top: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;308&quot; /&gt;&lt;/a&gt; &lt;br /&gt;
简单吧？&lt;div class=&quot;blogger-post-footer&quot;&gt;&lt;script&gt;
SyntaxHighlighter.highlight();
var linkwithin_site_id = 1130633;
$(&#39;#toTop&#39;).remove();
$(&#39;body&#39;).append(&#39;&lt;div id=&quot;toTop&quot; onclick=&quot;$(\&#39;html,body\&#39;).stop().animate({\&#39;scrollTop\&#39;: 0})&quot;&gt;Top&lt;/div&gt;&#39;);
$(window).on(&#39;scroll&#39;,function(){
if ($(this).scrollTop())
{
$(&#39;#toTop&#39;).fadeIn(&#39;fast&#39;);
}
else
{
$(&#39;#toTop&#39;).fadeOut(&#39;fast&#39;);
}
});
&lt;/script&gt;
&lt;script src=&quot;http://www.linkwithin.com/widget.js&quot;&gt;&lt;/script&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://garyngzhongbo.blogspot.com/feeds/2564887025546387180/comments/default' title='博文评论'/><link rel='replies' type='text/html' href='http://garyngzhongbo.blogspot.com/2013/11/c-14foreach.html#comment-form' title='1 条评论'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5319618319979683940/posts/default/2564887025546387180'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5319618319979683940/posts/default/2564887025546387180'/><link rel='alternate' type='text/html' href='http://garyngzhongbo.blogspot.com/2013/11/c-14foreach.html' title='[教程][C#] 新手入门教程#14——Foreach遍历'/><author><name>Gary Ng</name><uri>http://www.blogger.com/profile/00014057672539539340</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg9iwlDA6AUjQlOcui80uHFcQrivUTnGffce910nal6ynGRz3WPKYm3jT-Ipf-jzFTjxCCp8nk2kuV-33RoHUPT2O3_awWs3y-4kwFLHfQ8kPO21Kgtd3rQ0dD2BcN3Nib9T4UJtJc_I9eq/s72-c?imgmax=800" height="72" width="72"/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5319618319979683940.post-45561102588609985</id><published>2013-11-27T15:04:00.000+08:00</published><updated>2013-11-27T15:04:13.540+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="C#"/><category scheme="http://www.blogger.com/atom/ns#" term="入门"/><category scheme="http://www.blogger.com/atom/ns#" term="原创"/><category scheme="http://www.blogger.com/atom/ns#" term="教程"/><category scheme="http://www.blogger.com/atom/ns#" term="新手"/><title type='text'>[教程][C#] 新手入门教程#13——For循环</title><content type='html'>&lt;p&gt;如果老师罚你写“我上课时不会吵闹”100遍，你会怎么办？&lt;/p&gt;&lt;p&gt;你：呜呜 大哭 然后泪奔&lt;/p&gt;&lt;p&gt;我：…&lt;/p&gt;&lt;p&gt;For 循环很简单&lt;/p&gt;&lt;p&gt;听名字就知道，它是用来做一些一直重复的工作的&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;（创建新project，加一个button 等等那些我以后都不特别申明了啊）&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;For loop 的结构是这样的：&lt;/p&gt;&lt;p&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgJFS9iWy7h4E74CsgOWsP5S2QkirGeXEjRI3a_cYH3OKyhxOKZaw5jTySWYpMXFwnflmBJYnnYf1nMzwWCYixBa43wIarzeXZfJfIpcylFoI3PlKgNObBERqmIwVlNcOcv8o1HYq7StmGh/s1600-h/image%25255B5%25255D.png&quot;&gt;&lt;img style=&quot;border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px&quot; title=&quot;image&quot; border=&quot;0&quot; alt=&quot;image&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjU86Nye_g-eFT5BTjoB7-qZWbrgCXITvjoDTO_MWFTnZYKVmcbtYMh-SPclIuR4FPRQ3_4nD9ekdAn616M5MC47GgQMwWF6yTJawYPV9IKnjW4Wuu3rMbu4u5M18fG1BJQXjUG46F231pc/?imgmax=800&quot; width=&quot;407&quot; height=&quot;100&quot;&gt;&lt;/a&gt; &lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;blockquote&gt;&lt;p&gt;first part&lt;/p&gt;&lt;p&gt;就是控制整个for loop 的变量&lt;/p&gt;&lt;p&gt;它可以在for 之前被定义&lt;/p&gt;&lt;p&gt;或者在for loop 时才定义&lt;/p&gt;&lt;/blockquote&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;blockquote&gt;&lt;p&gt;second part&lt;/p&gt;&lt;p&gt;控制整个for loop的情况&lt;/p&gt;&lt;p&gt;当condition等于false 时，整个for loop 结束&lt;/p&gt;&lt;/blockquote&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;blockquote&gt;&lt;p&gt;third part&lt;/p&gt;&lt;p&gt;这个部分在整个for loop 完成一次循环后救护被执行&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;/blockquote&gt;&lt;blockquote&gt;&lt;p&gt;code body&lt;/p&gt;&lt;p&gt;就是在每一次循环运行的代码&lt;/p&gt;&lt;/blockquote&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;比如说你要显示5个message box&lt;/p&gt;&lt;p&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhzxHZiyN3GNMHgE716bJykn72P516RLonMcJm9lFyZBg9LTE-N-bw0-66hO1mw2DBJhi9k3p6FL9SHZsbDWvCg2DQNHBdYcWsOkaRfpB_fKHFHMbBkMUEitYF_RWe_mzkO9tG_ne9xrQeV/s1600-h/image%25255B8%25255D.png&quot;&gt;&lt;img style=&quot;border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px&quot; title=&quot;image&quot; border=&quot;0&quot; alt=&quot;image&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiXSWCzL3hcKBA6-8U7sWFcmFkknK1Nw-Q1IF5Ke0dwak83J8Cnj-13IyxJcm4NMMCXZxT60JE0eSMWysG4krk-315TqlpCQdF2MXf5rQa-E0C_HHFsYmzmcvsY7AckEV0uqkmQSdmATJGP/?imgmax=800&quot; width=&quot;414&quot; height=&quot;131&quot;&gt;&lt;/a&gt; &lt;/p&gt;&lt;p&gt;首先它会申明一个变量i&lt;/p&gt;&lt;p&gt;而且i 等于 0&lt;/p&gt;&lt;p&gt;然后检查i 是不是小于5&lt;/p&gt;&lt;p&gt;如果是&lt;/p&gt;&lt;p&gt;执行Messagebox Show&lt;/p&gt;&lt;p&gt;执行完毕后&lt;/p&gt;&lt;p&gt;就会执行i++&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;现在i=2&lt;/p&gt;&lt;p&gt;然后for 会检查i 是不是小于5&lt;/p&gt;&lt;p&gt;..[余下跳过]&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;现在i=4&lt;/p&gt;&lt;p&gt;检查condition执行code body 后&lt;/p&gt;&lt;p&gt;i++&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;现在i=5&lt;/p&gt;&lt;p&gt;可是i 小于 5 的情况不成立（返回false）&lt;/p&gt;&lt;p&gt;所以整个for 循环结束&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;这是结果：&lt;/p&gt;&lt;p&gt;（想想为什么不会看到5出现？）&lt;/p&gt;&lt;p&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhY8MlVPg0nK1Q7fBEs3I0xaTJbLUBFMSrYDOjj7aV9mlRAx-VmjFOZZkryNy_T07f1F9vSgApszP3ieTa5JDrbhSAK6khw9jcC3cM3N5ltwBoQT4yP4uSobrAyfJyah7JWEc9-UyrwJaIn/s1600-h/image%25255B11%25255D.png&quot;&gt;&lt;img style=&quot;border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px&quot; title=&quot;image&quot; border=&quot;0&quot; alt=&quot;image&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEidk8uzZQWuVRpwjIVoNumtScXpHe9izmwUUio29MpyVnAaJdRt-owQMjxk3aUxf3CBavKKEwVZFusUpt9o369eMeV9Pvtun87QsONpgcRzEo8gmJ0jpzt3Vh0v37YNHBwenpXeQA1AuD0P/?imgmax=800&quot; width=&quot;300&quot; height=&quot;300&quot;&gt;&lt;/a&gt; &lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhYqvvg6dl-KfIocLlb-380eIiUBdOyyIUMYq3QVEabnagmfrQcJ2CEMK54WrExUVV-DC12fNlmd3A2dVbj0Kh0I4U1UGQ1PL_RW1zmRyXjhLUKLsDAEQWBpWL-hqkDkX44FXxR_t9dZpM5/s1600-h/image%25255B14%25255D.png&quot;&gt;&lt;img style=&quot;border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px&quot; title=&quot;image&quot; border=&quot;0&quot; alt=&quot;image&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiRDMV0aGZKZ1B7C6Mk7rOvWg39xfV-DKPG-Vt8S5yq8wo6zlKfwVMVkIUZnWu66dhPYHZOUmlxQyQ9Pf0R4-VykLkt444azAZ8ARSzRyq9LGPiC4f0OlbitILwIo0fqYAaYHrNuEE3x45g/?imgmax=800&quot; width=&quot;300&quot; height=&quot;300&quot;&gt;&lt;/a&gt; &lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi29xTshsR7AZthzZRZO1kA7w2KIboY_TnGfeSHk1zid6c9o3_hDmq9iNBJE6yCqrCGChwCyIOvsGoF7QDnAqBUsAYwOtfBF9PbS_L0FXMF5akI47Iev8FkIBIzYE1bo6XUp4tIQND_T2Pn/s1600-h/image%25255B17%25255D.png&quot;&gt;&lt;img style=&quot;border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px&quot; title=&quot;image&quot; border=&quot;0&quot; alt=&quot;image&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgG-uYX9DCmiCruJr_1vgGpNR1YgfosmCU2p2no3xTab_WfM0Z4Qul3vWYcPcK_kPgKptDwDJIr-BHbxzy28XKZB2KZq8-ZhB8k9Cn8Xp0drOzyO5fzXD0X8vhndML-K9pPa8a7sjz5wmLu/?imgmax=800&quot; width=&quot;300&quot; height=&quot;300&quot;&gt;&lt;/a&gt; &lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhabRoYMiA9uddL0lgiTc_6F653XqdzVrn3irfqtfv5L4mua_S8LpHFcstN0AAoBeKE-f6TAEGMum5gLOUYQ5wJ34dw1332MFxE3jdtH0Dhvl4GDvu6Jxsk2GemPN9SMM0TRQ9zTekP3pnq/s1600-h/image%25255B20%25255D.png&quot;&gt;&lt;img style=&quot;border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px&quot; title=&quot;image&quot; border=&quot;0&quot; alt=&quot;image&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgnTCSTDfLBQH6pd6M5g6hQKbNbq07BhKBB0Xuh3C-c6Xnop8ptMEl3MzOyv664W7EElx0HCBs69U-xKrWEWlM6F4dDK2ojT0oRm3JRfK0KLRi9i_dDtbMM4bv2l4THlJ158zhwwg0CO3TA/?imgmax=800&quot; width=&quot;300&quot; height=&quot;300&quot;&gt;&lt;/a&gt; &lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjYxMzLYejm-OmLnMe4tGrm2sxhj-J8ftgLoyxobcZG-DrRZJPY7EukEn0PwxfGo42Y4Lj9B_Iu__uIPKlFPxiHZU_MAJimM0Kv0QvxewYItbzQiQWjxkDOAh0c9_mGP_DYvWn-Nbi_MOsg/s1600-h/image%25255B23%25255D.png&quot;&gt;&lt;img style=&quot;border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px&quot; title=&quot;image&quot; border=&quot;0&quot; alt=&quot;image&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh-Xbg20JutQ_g2GWykYntMllDOl33Ub-wjmszLpIyxkbYT_6mhgYTAiI_8yhq_UsVwvvw1PbYzmyV2Zxzxfmtn87-fapHYZFtLIMAJHgjztso9M3sCRFChrwKG_oa3cI1IuEZCaVBRjEgF/?imgmax=800&quot; width=&quot;300&quot; height=&quot;300&quot;&gt;&lt;/a&gt; &lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;你：假如我不要0、1、2、3、4， 我要0、2、4、6、8呢？&lt;/p&gt;&lt;p&gt;更改i++就好了啊！&lt;/p&gt;&lt;p&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjim2aeMoyNb09q-2QUVUrQ2UiiatZWmtNgt4ryltOFbJEcwM8px9evbnQQ99esYwChnZ2370lfr7Im7V3BFtEkLVKf1PL4Jdzjr_g4U138qhzrkKxqzqUjHuGaQI7QmvRP8rNm1XSlVzYV/s1600-h/image%25255B38%25255D.png&quot;&gt;&lt;img style=&quot;border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px&quot; title=&quot;image&quot; border=&quot;0&quot; alt=&quot;image&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEieYVQ1Gf3EHVR7b4IqXij3tvsZzJiS9MGjp_tYwEhPVa6SQl2HhxrI_2-EVN0gfjxtxsV5aoOx4j3UvtG0L35Hk0NK1dWVy3mXg4fCnvNkaT6erL-_Q-rdrN5QqNCVaNWkU6W6AZNYLnBq/?imgmax=800&quot; width=&quot;439&quot; height=&quot;136&quot;&gt;&lt;/a&gt; &lt;/p&gt;&lt;p&gt;i&amp;lt;=8 就是代表在i 等于9的时候才结束循环（这代表整个代码也可以这样写：&lt;/p&gt;&lt;p&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgWZtILHZTb0meit_67gQ2rZh_RmWCKS63naQPSbC_BDOWuPOiP_v5H3RVdz9ZmjFTEHhuc5lpMmifRMc-wHn21Qg6oXCbegocGqGgFP1jd19M1wsv12SZHmtcrXuJhpPBwiq5YswWltnpZ/s1600-h/image%25255B41%25255D.png&quot;&gt;&lt;img style=&quot;border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px&quot; title=&quot;image&quot; border=&quot;0&quot; alt=&quot;image&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhE-BEaZRCjDjdvVQAshnbbVIHm6Wp_9ep0zilbI06r5xShp_Gd3LvhNEOL4tKdxJkmAtwPy5GY7lBakAspdt8IPjZFXKmMAzJtKgdraKsJXA8K8kIahLVjAfC-AZXLuhGDIQL3Yhj8CRPT/?imgmax=800&quot; width=&quot;439&quot; height=&quot;136&quot;&gt;&lt;/a&gt; ）&lt;/p&gt;&lt;p&gt;i+=2 就是每一次 i = i + 2&lt;/p&gt;&lt;p&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhpoM5O9SziCSO43VgrO6DUpjmzuHN-1YwhnZmVuiORPplGyHbj9cvayEbZ5bAA-i8r2Ooiz1CwadbUDrH0EVbesYEXysLLiwrFfbxGUp_Xszsf_st7jCEeD3SGz8tiw-51Z0mMEUHWorpi/s1600-h/image%25255B32%25255D.png&quot;&gt;&lt;img style=&quot;border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px&quot; title=&quot;image&quot; border=&quot;0&quot; alt=&quot;image&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj2fgHHgOIrMIHUslWvPz8i0tWl3eChLPkSITTQlvfS7dNkBxbz51_jkO_YmPLg3435A7Q-jShMDXnZiS1aQxUhG7E7kNJ1dPLRvukTYU85TdpGB4CbTxrC55qVkBFn7xXJsB3hRH5raNnY/?imgmax=800&quot; width=&quot;300&quot; height=&quot;300&quot;&gt;&lt;/a&gt; &lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj5oJtv0PDbmOVF5kPueWap22bZ0YoY8YcbMjLvGzuJrk5kNE7nteKX8FhW8CkI6bc15hMRfa8JEi53-sLJ_lbIUJAED7G0IH9eDymuQFm12BgTCD9m5X45lh9Edds4MxmR664r_SMarEOh/s1600-h/image%25255B35%25255D.png&quot;&gt;&lt;img style=&quot;border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px&quot; title=&quot;image&quot; border=&quot;0&quot; alt=&quot;image&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiZgsyeFiXaBJ5CQ-t_AB4LjNDj8HeCFIpJGiMYb8SA_PyrvJ3RfAb3vlFZm5TCn9CbEI23ZYKddlz0nw_JPIczuqD_oCCK27fEcCZFPYhh0uFntAqHc4aoN1vh71yMcTaZT04MWLoLVSUs/?imgmax=800&quot; width=&quot;300&quot; height=&quot;300&quot;&gt;&lt;/a&gt; &lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjONx_FUhP7pgTR_2RRE86Elg0ajgH10NpNOJRZlNXH2n7XHHOH_XEcI-fdY1U4YpSfUit3Xm_WwL58idmck8Vhtkc3SM99R9bAjpImfZEUirOGaLKEP_sPQsn7kMEs9YK3S0stF677a-Lt/s1600-h/image%25255B47%25255D.png&quot;&gt;&lt;img style=&quot;border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px&quot; title=&quot;image&quot; border=&quot;0&quot; alt=&quot;image&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgpnFPdns6YrbdyiCDcsfY_iHzdPRUXN3JyQbBKV1TMZHgY3bQI58cNI_e1DETG5pZTWDwd8-_3HcPw56uMERURyLM1xYc_Eo7kS-vxjWVo6Px6AVbtqA1IhTq5glEHp3HEOleWIX3uow6C/?imgmax=800&quot; width=&quot;300&quot; height=&quot;300&quot;&gt;&lt;/a&gt; &lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhPc-9OIBJMmcs7NCDXIoDVraJgowPsidiy5ZPz0Dn6yURA5cAPehyu-FhUC0JpMqzK6UD_IXN558zx2djQUdJHMixVEciRbXd1JHjbn2oUts1U9OdZ8URHwZrB3qPIrBS9GbyZYFcQLGnD/s1600-h/image%25255B50%25255D.png&quot;&gt;&lt;img style=&quot;border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px&quot; title=&quot;image&quot; border=&quot;0&quot; alt=&quot;image&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh_p95V0u1ybejX7J5OpPCMiD1UpnEOYy-rgLD2UJCFFOfcqtt8b3DXCJv6Ol6jqHIqjAEA6R3nDRbAC0Yjt2qULWRWCONTMpqlE1u5ioVmjGTbbRVK-8BeUnqr3lDixv1pDCuwJQBTENpK/?imgmax=800&quot; width=&quot;300&quot; height=&quot;300&quot;&gt;&lt;/a&gt; &lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi9cjHiG2a7z3Q2MbIcN5GkRMjy4ekzZWxIUmyLrdu-6SLXSkFCaqFGpDr0C0C2DBz9YXDMBKV4mya6RvyZDfM-E0wgaKGhnvGMxrUc3BWF2f2H_UHO1TEhW_QWfajLssUUr5EyejH6hbKk/s1600-h/image%25255B53%25255D.png&quot;&gt;&lt;img style=&quot;border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px&quot; title=&quot;image&quot; border=&quot;0&quot; alt=&quot;image&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhqsTnfqXoVjsGsj7y_lMUkzCE_SwprUAlvOQ1mrTOyYcunvbXOKw5eY-_5QkJP7mLUmTWzyVPJrlvZk9ZDEvlWd8Lt-J7DffsQcx92Z1EbK5cEU27s5nwK8FwvI6UuLM9kQasNDGunU_aE/?imgmax=800&quot; width=&quot;300&quot; height=&quot;300&quot;&gt;&lt;/a&gt; &lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;你：如果我要4、3、2、1、0呢？&lt;/p&gt;&lt;p&gt;i++ 换成i--就好了啊！&lt;/p&gt;&lt;p&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgN4SraSktvDdiKRP4pRW89tRbOLTcuvhc1jzqtP0x9JjRXlk0OQ_iPmbB1lZoePrjoXgQgO8_gPvkSq9qf_YB8FNskV_n9BAFFCdwSwouFfTWEMZN1JcoF39eZmYR6FKPM757hJFTtf_4L/s1600-h/image%25255B56%25255D.png&quot;&gt;&lt;img style=&quot;border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px&quot; title=&quot;image&quot; border=&quot;0&quot; alt=&quot;image&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhdGlP2-JXEdG5JGDlVwatoYcxYWmCq4B4S0SeS7UF1DGI01Ci96VSyDipVK0k3T1wSuSTndjrZ_hB-dyb4GDeeBTjL5tAKaCK9hS_phIKW3BYsuiugp9Vf9t4TKX9ErEFjozI8K371cVCH/?imgmax=800&quot; width=&quot;413&quot; height=&quot;127&quot;&gt;&lt;/a&gt; &lt;/p&gt;&lt;p&gt;i&amp;gt;=0 就是i = –1 的时候结束循环&lt;/p&gt;&lt;blockquote class=&quot;bq_info&quot;&gt;&lt;p&gt;注意：int i = 0 变成 int i = 4 了！&lt;/p&gt;&lt;p&gt;因为我们要的是从4开始&lt;/p&gt;&lt;/blockquote&gt;&lt;p&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhwEI3gtcxiC_apwHbRJ6gN_i_voQpU7cE1TDq6cDGCIczgVbx-Kl2wEbudEv_G1Xkuk6uaSDU3sbysDDHXodyWgllsA8175WtbeWD7W7DmY_6bq4Mca_U6WmLlGXKX9jcSI4tqqXcRycro/s1600-h/image%25255B62%25255D.png&quot;&gt;&lt;img style=&quot;border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px&quot; title=&quot;image&quot; border=&quot;0&quot; alt=&quot;image&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiQQDw-bMRJCYunp3O3rE7V8VdgzZSdYR9-Bsvg_ckKrwBygIH0KB79H9wS-xLjHanSz7ZbortaVgK8MIutuqRLDqwDovP1ZShuNEvYabFMOMxKRS24_qZ3iDwO0mydl7cZBwzHg4LKQRC9/?imgmax=800&quot; width=&quot;300&quot; height=&quot;300&quot;&gt;&lt;/a&gt; &lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjS8fsbXjExW9gVNyk0etLfUuYkgoWLtwJ2P4Uofynj-_zi-NNX5MwqH_sIZ08_r6GHr1IogJ4UancdbeiS7BYe8pvmFCxEvgYKX8UH5_7M3ldKCJQ-2McdbTplAfiwI_jK7b8uTOk76vk7/s1600-h/image%25255B65%25255D.png&quot;&gt;&lt;img style=&quot;border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px&quot; title=&quot;image&quot; border=&quot;0&quot; alt=&quot;image&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgI4z5GueL7uILiZsNjaXBjDqboL3c9W8fzwSLBw8lI7fwsyZ_pagIeOJdNr9u_Q7orcd-7TTLTWLD-YPmJ54GSoWHvKh-B1-U93EcnLjCDGqc0awDAoT1yFuj5xPJTlFDDg8WCbw3ngYlq/?imgmax=800&quot; width=&quot;300&quot; height=&quot;300&quot;&gt;&lt;/a&gt; &lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjfsq8qZ9HJ7vq24FmuHe3g2BKZ2zgoZtvqKufGbnlAg__7K_G0yQUrQE6Z9NMpyQKE4pxv630-o8-Y9IIbpje2LFF1p6AO_tuFmJX5hnt3kiwli8k5v4WCluUcsWT25gXiVFKBpOKtctz2/s1600-h/image%25255B68%25255D.png&quot;&gt;&lt;img style=&quot;border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px&quot; title=&quot;image&quot; border=&quot;0&quot; alt=&quot;image&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhh6Cw5y1rfJILRR9yDALHfITep43qA-Kaudhe2lU_kLGHFZSIGweOudwd5hoUrC2ZgfUGwbHyPqnwTFa9t6pJ3ANDPqu7ZMCc4dotS3I3Knun3bFLGN44RBbY2bu6xC4YFX-rOQoNXoKaB/?imgmax=800&quot; width=&quot;300&quot; height=&quot;300&quot;&gt;&lt;/a&gt; &lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg-v5wf_bmwyGA_7kbyx29-kiz5M_v-UndglWWTQDLESe-XxOWmn9z5VsjiLVFBIksBVxO_7PJC5wEex6e-TdOiqhJlG6xNldMA1azEfl2bGAE5cKNkVLOS0zO0Y8x9pyP65EHqoitqKeHK/s1600-h/image%25255B71%25255D.png&quot;&gt;&lt;img style=&quot;border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px&quot; title=&quot;image&quot; border=&quot;0&quot; alt=&quot;image&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjwlDOqmTTZTGbxwnUrqwLe831cEfDj6yNErduixiRWe9qQlTnpqBTMgyTa1I8EIeuyIr9XylCqhpJM1AGngb8-9chyphenhypheneEWeE3VtFCpFvQ1cbY11hV614TYCMKKMZALSO3avTakqrwTKtFmt/?imgmax=800&quot; width=&quot;300&quot; height=&quot;300&quot;&gt;&lt;/a&gt; &lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgsSVgGon_ZFA9rtftrlb-MAD1Oy6-qBJB1n6z1LcM00uWQUp9AggLr6DyO9h0m_G9h3SturOAh94N56FINlcChlSgxfPz2owvsgsohCDd4ZP2I_tXOdL5As0a32R4rNbxmJ-4jV_7Pfzx0/s1600-h/image%25255B74%25255D.png&quot;&gt;&lt;img style=&quot;border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px&quot; title=&quot;image&quot; border=&quot;0&quot; alt=&quot;image&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjZdSWgKj4UnxbjPVAE1jTAjkD15CK7cw2iEeOp1EyFXH2AMCg_iQnOe4UW_bKshxf9iH9n27rRnMOVgv31reZCv9G1wez3DzCrmCynHBmlI6r0MCbUmyV-44xftoQpkecdDPxDenjiGZve/?imgmax=800&quot; width=&quot;300&quot; height=&quot;300&quot;&gt;&lt;/a&gt; &lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;简单吧！&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;还有就是如果你要无限循环&lt;/p&gt;&lt;p&gt;就可以直接去掉condition的部分&lt;/p&gt;&lt;p&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEimLVRKiBSNuwKeQV_eEYsgn-GD8H4Z_8ouZpWQZUawRT6NGyJND0d28mB3_ntteFAXwZet1T0dCdKDD0r3ElwQflvUQH0oeiTKCH15Vh1NC2RIa5Jsdn3Yq2kIVrE5DWaMe-TlRRgVgi6y/s1600-h/image%25255B77%25255D.png&quot;&gt;&lt;img style=&quot;border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px&quot; title=&quot;image&quot; border=&quot;0&quot; alt=&quot;image&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiPAyOXN14VPeUdDUtwj6VM8M9-CVujZVGK_L4Euti3RymXWvnUhN2hMygnx3eY_7vq3K7gZD0TODdKfeVkPrYqLYgwByE0lfSoA8zlrILDUNhT2KRcmeIahNDcyMW9jJ-3UHsHIylv27-S/?imgmax=800&quot; width=&quot;401&quot; height=&quot;130&quot;&gt;&lt;/a&gt; &lt;/p&gt;&lt;blockquote class=&quot;bp_warning&quot;&gt;&lt;p&gt;注意：这是无限循环！要结束的话 可以点击&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgIvslZburcQliQYALvbhvPbXZzJzv3nNVU6Skcu1ag3Vj4RgWbQhN_B3xzyZycWMqnlqrc_mtSdlyfQ_G4-FnFK_OJVc-jwsH12aXGo3wEhvnOYz7EwA65CJ_roXn8mOgMs6bn801tWDsN/s1600-h/image%25255B80%25255D.png&quot;&gt;&lt;img style=&quot;border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px&quot; title=&quot;image&quot; border=&quot;0&quot; alt=&quot;image&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiuq34FmvKUNBLP4Rr5T0-PY4HdAgi3aL8qp4gx4AO3RWHOHpRZmtMa97S6yBhdkPrZ-ZVHmza3Q_M-tTqj3hO_wSUZhnffIz1AgrqMoeF9pLXFtv_Sjb0sJuh9R8aR1Cyp1nH8LU5-sZoL/?imgmax=800&quot; width=&quot;22&quot; height=&quot;27&quot;&gt;&lt;/a&gt; &lt;/p&gt;&lt;/blockquote&gt;&lt;p&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhSxksrc9W8-10Do0EscruTdGxiOwF_Re5Q8koL-UAxxq8wOu6lIuohxciZ_YttKiBPA8zFjZfCGbWg8TxzPo_nnuwr0KRzb8aRjYy9i9t9IAE0F6Q2VtvOU9ndv8Gft6MYONnZPVesX1Sj/s1600-h/image%25255B86%25255D.png&quot;&gt;&lt;img style=&quot;border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px&quot; title=&quot;image&quot; border=&quot;0&quot; alt=&quot;image&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh3_MP4flt8toY-sR88fGRZIrkvcQWzXc_h31cs6HAF_Djeo0vCIj-mAVy5_A3HsUL9oYThREDBJKQYjzKtYn3uoRoLs6LJhiWEX3m99lBAUMOdGO6jwdTHxzRawuXqe_6VlOPrwzhr3imN/?imgmax=800&quot; width=&quot;300&quot; height=&quot;302&quot;&gt;&lt;/a&gt; &lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgZoLbjXl-_vzqWd4Q7phP10vhtB1PqruF6KcpEB1aLhE5dUWOXWBr1MdIXncF23096cpv6gYAYAvoTriPntfTYw0cx3ZU73CHBWB1JKqu5WRo6kCd21xGHkJOiLtrbog24hvkgcaXm-9Sk/s1600-h/image%25255B89%25255D.png&quot;&gt;&lt;img style=&quot;border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px&quot; title=&quot;image&quot; border=&quot;0&quot; alt=&quot;image&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgMzHr78Kh7akAi7_W0F96SocTrjSpyUeBOWmAkPVJAlg4JUe3xsWhliR2Rpm9VR-_RZk0hKRCGZ9dUk05dIVYcaOsAPQXZmUBURQ7V0H5il-j6R_VsBzeQGNuaLwifuw8UdxogEMzuo6uL/?imgmax=800&quot; width=&quot;300&quot; height=&quot;302&quot;&gt;&lt;/a&gt; …&lt;/p&gt;&lt;div class=&quot;blogger-post-footer&quot;&gt;&lt;script&gt;
SyntaxHighlighter.highlight();
var linkwithin_site_id = 1130633;
$(&#39;#toTop&#39;).remove();
$(&#39;body&#39;).append(&#39;&lt;div id=&quot;toTop&quot; onclick=&quot;$(\&#39;html,body\&#39;).stop().animate({\&#39;scrollTop\&#39;: 0})&quot;&gt;Top&lt;/div&gt;&#39;);
$(window).on(&#39;scroll&#39;,function(){
if ($(this).scrollTop())
{
$(&#39;#toTop&#39;).fadeIn(&#39;fast&#39;);
}
else
{
$(&#39;#toTop&#39;).fadeOut(&#39;fast&#39;);
}
});
&lt;/script&gt;
&lt;script src=&quot;http://www.linkwithin.com/widget.js&quot;&gt;&lt;/script&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://garyngzhongbo.blogspot.com/feeds/45561102588609985/comments/default' title='博文评论'/><link rel='replies' type='text/html' href='http://garyngzhongbo.blogspot.com/2013/11/c-13for.html#comment-form' title='0 条评论'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5319618319979683940/posts/default/45561102588609985'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5319618319979683940/posts/default/45561102588609985'/><link rel='alternate' type='text/html' href='http://garyngzhongbo.blogspot.com/2013/11/c-13for.html' title='[教程][C#] 新手入门教程#13——For循环'/><author><name>Gary Ng</name><uri>http://www.blogger.com/profile/00014057672539539340</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjU86Nye_g-eFT5BTjoB7-qZWbrgCXITvjoDTO_MWFTnZYKVmcbtYMh-SPclIuR4FPRQ3_4nD9ekdAn616M5MC47GgQMwWF6yTJawYPV9IKnjW4Wuu3rMbu4u5M18fG1BJQXjUG46F231pc/s72-c?imgmax=800" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5319618319979683940.post-7349484015695388749</id><published>2013-11-26T19:05:00.000+08:00</published><updated>2013-11-26T19:05:44.680+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="C#"/><category scheme="http://www.blogger.com/atom/ns#" term="入门"/><category scheme="http://www.blogger.com/atom/ns#" term="原创"/><category scheme="http://www.blogger.com/atom/ns#" term="教程"/><category scheme="http://www.blogger.com/atom/ns#" term="新手"/><title type='text'>[教程][C#] 新手入门教程#12——List</title><content type='html'>你：如果我不知道有多少个学生，但是我想把他们都储存起来要怎么样？&lt;br /&gt;
很简单，List 就是为此而设计的&lt;br /&gt;
List基本上很类似Array&lt;br /&gt;
但是List在申明的时候不必申明特定的数量&lt;br /&gt;
List可以动态调整它自己元素的数量&lt;br /&gt;
&lt;br /&gt;
（一样的，先添加一个button，和一个textbox，然后双击button，进入event handler）&lt;br /&gt;
&lt;br /&gt;
看之前数组的申明：&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi7BzPpRyIcjptzKXC4SnLHKKiubIoOPYOkmIQS2ialyYhH77FZ58NVHievFCR4q3VP5GVi-7OGuKeG5h23YrfokXjRMxswErfmz5YBjnkGMBnjWZ55kqJt0Qo6Gt-o1J3_FPRs5hNdYiuW/s1600-h/image%25255B2%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEikz96DK7AZSXKxbSDZWfrMJxGgRuoEW6SSysjpFtg0GBSB-FYW5zVfnHBCN3oFBig0WHw9Vr0FzneT5DWRBWWDulgoFf7FlcrOH3gWszkpB6s9XhwEGzyvicxs0M9b3B9s3bpMaaBpjWHj/?imgmax=800&quot; height=&quot;88&quot; style=&quot;border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;400&quot; /&gt;&lt;/a&gt; &lt;br /&gt;
可是如果我们不知道学生的数量的话&lt;br /&gt;
[]内该放啥？&lt;br /&gt;
当然你可以这样：&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjMkJfYPABUOre1a7jv39lUaHoa81NqLBYsgsIcNbWVMzA1WxBclc8oTN_taHrWsE7p8sjohdE_ik6OdrkA4yP-pRJ7VMWOcjJTl2-Fsqm-_OZtbQx_kdfEtkQfLRV7lFciyHqN5y9JWAuK/s1600-h/image%25255B5%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhWEqyNOtBYjNpaH2LCpzLpiJMSZYGiNCUTXHwyjF_Jr5bx65mLiGZREBOIVfzx80fxy0SwLpRG3v2tMIrBaBph_jpMJDvO-glNZAOxtv5pFMDokoFbPdgJq5_ZUjAa4htNaCFX8JqrBCfo/?imgmax=800&quot; height=&quot;88&quot; style=&quot;border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;400&quot; /&gt;&lt;/a&gt; &lt;br /&gt;
构造看上去填不满的students list&lt;br /&gt;
但是如果你想移除一个学生呢？&lt;br /&gt;
&lt;br /&gt;
现在来看看List的申明方法&lt;br /&gt;
如果我们要申明一个string 的 list 的话：&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiOBTJBog6eESiC79RMtT9vrq2_IUJibUOurxtvhmYGFl2TJ5BrVWjzsWG2H_vejMyQTs1l8SjF9lO4tRAt2Ss3q2TFLNTGn7jtygBEcZwScABaCHLsUDilDac-lpGerKiMH8Oa6cF6N9UG/s1600-h/image%25255B8%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgJYZ9dm_NZqRuKi5vZeWpEVyqFuSE3iuTI9GHRZYQo6MntZ4cKHZES1ZQaTytaOuT60sgL2K4ahhyyPcW-CLlMAwuwa_ne-Y8AuAz0xK9-0SPuyUdtGgG6JtpNtnsgInmeAUw-TTJukTne/?imgmax=800&quot; height=&quot;80&quot; style=&quot;border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;406&quot; /&gt;&lt;/a&gt; &lt;br /&gt;
&lt;blockquote class=&quot;bq_info&quot;&gt;
记得这个&amp;lt;&amp;gt;符号，里面包含的是整个数组的类型&lt;/blockquote&gt;
然后跟着数组名称&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhnT8TB5iD-CYeWf8EH69nzghJA3aHMuAYKtJPeX1_vnpYRWqNCQhX0fkYSZqrK-sioE5U6lze1gqlvANlVNaIf8UCTrdcpV1-_WQsCKDNoJW8NFk-CLeaKJxON6LCaCdI-mUX_A_8gRkTx/s1600-h/image%25255B11%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhj2GxBcOLpYkr2Zo9bre1gnfKHAy5ExgHup9yt20E4R9IwdvYs6phNAGnZ5A-GwRMWTgNBNX-xliZ1y5wn_QsXTkyuLIKrv8CFzlIBWn-ejw0UKcHYixI8J6k2ZO1LTDz_Me2-OhNlvkIs/?imgmax=800&quot; height=&quot;80&quot; style=&quot;border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;406&quot; /&gt;&lt;/a&gt; &lt;br /&gt;
申明时，不必特定整个数组的数量&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi-Vh0ZrAzHsn5aOsszD0JKEqfxhMPKQQu-lpastlz0JihyphenhyphenqNgzhzm_RxBdYPjfcqBERdGx9KrETcJ25p0SnCeCh-6gLZRWWEhJbyOlLj0vRjoSiXFmOnnVJpULmSgrw-R9Fsk8A2-AKZAJ/s1600-h/image%25255B14%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhpo9hVOUAIftUHkp91xUIA_WPH2v9w8U_Z8Bma43Pb7bv-C23C-PDuaB4-j1Pf6UgWzueecREzWEbqirI9Cstjp5Ryoq-6Sj0TyKC86ELfvjuDlbpDNSXbUbiT6x4Bcp9JXzVqNLrr43CG/?imgmax=800&quot; height=&quot;80&quot; style=&quot;border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;406&quot; /&gt;&lt;/a&gt; &lt;br /&gt;
&lt;blockquote class=&quot;bq_info&quot;&gt;
记得要在尾端加上()&lt;/blockquote&gt;
&lt;br /&gt;
你：要怎么添加新元素啊？&lt;br /&gt;
我：添加叫啥？&lt;br /&gt;
你：Add！&lt;br /&gt;
对！&lt;br /&gt;
每个list 都有一个方法叫做Add&lt;br /&gt;
它将一个元素加入到整个list 的尾端&lt;br /&gt;
比如说，要添加一个学生叫做 Bryan&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhAqhUU1j0jaxCJhDPf6xaN8tJOMhy25WvD1wR5S4QIkqIQH0w9sXyMkVoiYZClfntiHVh5EvqaXaRljXdTNA0AfsZXb1nKCED-yTGuzHn6a8InqVLYL2HJ_A-ckKAuJx_fz1ig2W6AjE0Z/s1600-h/image%25255B17%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhLyrAsyQZPFvFpbkUjnaXOMf4EmyyinvjILbtAW8DrMF2EkE0JvMM6nuHwImEK9ZVb6CaFgx2macSfjBowlu_waLY6vjKEH6wtWQECPZMkmJJrkp99qGvA5pnkyk9qkkIGyE3FSh880uPM/?imgmax=800&quot; height=&quot;103&quot; style=&quot;border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;423&quot; /&gt;&lt;/a&gt; &lt;br /&gt;
现在整个数组变成了：&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgw2ul786qz2F3DzGNt4eJPc5xo29mVYC7p0smpiloCRne2GEGJ2l8tzZqBxObBNCzt3ulkbixQY0meVwmNT6wnW-19s3_FQQy3-5FOKuvdVA3yNwbu6iuSnwNxXwD0PCQy8RiQsBeLbzF_/s1600-h/image%25255B20%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi5hM9lzX6sJ1cX7Y4vZswi0g17v1JF3tWZFKsIYzMyMtGpOTXmlfKc5izbg_wZPHq6j2cKIa_6BAl4pGV8PH5CniJpvOvFujZWb8__Jq1AhZGr7N6GKZD9Gnvc6oR49QGBl-aEY1jgb6Hm/?imgmax=800&quot; height=&quot;72&quot; style=&quot;border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;148&quot; /&gt;&lt;/a&gt; &lt;br /&gt;
知道怎么访问了吧？&lt;br /&gt;
跟数组一样：&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgeV6WbuJjYN6Xkdg8mqz6lElEHdpW-eQMWxdjRruQ056A4GTWlZt7Sk4vgA85GDMWoQEpSHHXBqSocY5ta99tCIiZmYMZkfsxKC8KCiEHQb9e4BeRG22_ADoXiL-77IoDDmF3klFpxEYmw/s1600-h/image%25255B23%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgB8oRO7jv72rz9FYPCIV_5LEo1CkZVFBOZP2TmEh1DsPWx1Iiaa800du0OK26g2qqpzpzQH1ZWsjZZPawlX6zZsxIfKcHOWukv61nYIKhNzO_HvrNfMAZZl9S7z6QP1vl93Aoy0Muqn4rM/?imgmax=800&quot; height=&quot;116&quot; style=&quot;border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;405&quot; /&gt;&lt;/a&gt; &lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEic1HtYpXkze1VcUHjM95MCBnVX_qT8TbfSVfl5kb6KNe5v7bliMQMp2yvks_nSAcRW87onA5HNv_pGVFzrFpyrd7z_ukRApW6ZPQNE7WIO-2sHtxM2Zo6Ij6NNeswwpS1bFuyMj9d-fxOz/s1600-h/image%25255B26%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhTIxP6XgpLY4Vl81gvSZ9MnmuEexRzqg_FwTFnN18zinH3ySQ3QjxL7Clehqv9AeiaI0FBktJWtkTB4NFpD4AuXt3OOI0MJBmo-Px0fJyZ3Fxx9LeCYyzlaFJ46T8nZL7ytVgGrI9uPCP4/?imgmax=800&quot; height=&quot;300&quot; style=&quot;border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;300&quot; /&gt;&lt;/a&gt; &lt;br /&gt;
&lt;br /&gt;
如果还要添加的元素的话&lt;br /&gt;
还是一样呼叫.Add&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg1F2vALdvNgljvTuSnZLlZi3b5ZRmD5j8K4XuBw3Vv33FkzsTpXMFLB02AE2IPTC4-G1s3NLlRRsTGJaJ3rS05jU-q9L3_MzNInjhOTiVFhyIfuEb_xMvYglWkp6JBd-jxa0UnjTm-2iXu/s1600-h/image%25255B29%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg2osSgsQqS4m9wxidxPx10L3JqIFuhTDuNlfl7-uNsYiTEFTzrYHP7cQ8YHBn01OkO16YEMgO_IwSoUp11B-FZR8RgPcGlyQsCDHcygrsVKxvAbXxGmpoiiAoQbxkxr6dKjCaOL7FKS77I/?imgmax=800&quot; height=&quot;136&quot; style=&quot;border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;416&quot; /&gt;&lt;/a&gt; &lt;br /&gt;
现在数组变成了&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEitEfSgz1Yaek53H5Ft8qRybI2rJxCyapF24Uv9Hy0hCpHFPMlPZpQ-tZX1PY0Wb3jxJ2RVdMm1ptoI-MYXSblp8__KUgUoE3tr98KAABxM1qKK_JP8hGWOyIYDcR3WPh8mIGvqhLCMd3My/s1600-h/image%25255B38%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh40My-pNhqse5-KlihPPTmu1L42y7NwEiF0060x41Zkc2V0IfoH7hQHuCJcNszRmZwBNiygOOfSFpx9EULbS38ygz0lhgg-EY9up_E_nQvVFtuggeFJ3XKKNxw6kbME44TruQcCAlHuN9F/?imgmax=800&quot; height=&quot;100&quot; style=&quot;border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;153&quot; /&gt;&lt;/a&gt; &lt;br /&gt;
将两个String连起来，输出到textbox&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgso4hgcsMmtNSZx2D40TK3-rjrOdmaxPpEcuiGweYY_Qmz9tu1Juq7PqIlMD0w6WCV4rwBmGsTNUT3FWcRS1bnyMLlfn1J5jZvIdQZ4JI6mrR5aDqzg4z2ITW1cGPfbXfWX2L8GWalYmH4/s1600-h/image%25255B44%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjzt3Hwa76xbJjp9iMvmEm9r8GU9RrR8fXpwUof7zCOY5tdLPuN4-bv5mbuMpje7-nXE8SfXzIHptOx2K6lpJbt8hcmZqqlj4zzh4HV16iNcNLJDTuU79AQCz1iecJt9wG2L-_hcytQRy8m/?imgmax=800&quot; height=&quot;129&quot; style=&quot;border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;413&quot; /&gt;&lt;/a&gt; &lt;br /&gt;
&lt;blockquote class=&quot;bq_info&quot;&gt;
看到+的另一个共用了没？+也能连接两个string！&lt;/blockquote&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEin_c5IjBlZhlOYdSXsvUL_VNeyKMeVVEUJmvmU6Dk92-dmhHum13tGZTcoEjudGSeZHokAZy0_v0ISJulewzys_fraaraaDnRvyYRBVSpaKmye-6sitgs3mcZSvJw-IxzoJwY2G0cUsjna/s1600-h/image%25255B47%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEizGhTxeDkspFeiJzYLXEZ_StSgrp85effEG0L3X5wDLBIWKCMsWzOnPmHRD6qm1ZpAd52ZnRQnZQRXAYSgXuoZD0-XZ_QhuoO4Z65WydcSgBW0d47_OaixBmBVtqp2TtmrrfGoM4LbEyQ2/?imgmax=800&quot; height=&quot;300&quot; style=&quot;border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;300&quot; /&gt;&lt;/a&gt; &lt;br /&gt;
&lt;br /&gt;
你：如果我知道现在我已经有3个学生，我能不能直接创建一个有那3个学生的名字的List？&lt;br /&gt;
能！&lt;br /&gt;
有两种方法：&lt;br /&gt;
一个就是一个一个添加&lt;br /&gt;
但是我想没人会喜欢这种方法：&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiyXobnMyNcOiNE249ayrLlKEuJVLgVdYd30p3snLo_jYN-dSRb2DFLgo-msKp9WXaTDRndiLf4Nq6xD1UrboQsBkjr3CC3HXV1JtaF2CUn-Z2H-LzJxBWkGW5gMjQlveCcy4nVI5Qq3Rpy/s1600-h/image%25255B50%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj_TKgRw_7BO1E7nEcF7t9RCyQfCXmww4wt-9JLnJCeW0woAREs2NN9_cpuuKmzz7mCsEACMxgYete5MsVz095cO-Mli12NlvWwXHIMO0i4ZbaYVajDKsiyFUeBwjorgIx59v8XLfLM8vSX/?imgmax=800&quot; height=&quot;124&quot; style=&quot;border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;407&quot; /&gt;&lt;/a&gt; &lt;br /&gt;
你就有一个有3个学生的list了&lt;br /&gt;
但是如果你想要另一种更加简单的方法的话：&lt;br /&gt;
首先&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgnzCh_TmRS9j_S_E1L13-L9bSJGdsC1uh-TwJsBLtuV9pgz8BGXLKK87k7iCVpNL1j9uTIQ8lxgiQybYfgs0b6Tr7eD3-atqYZOOt9dPtWOmoeMi6yd6TwUIEEE3MEIDNRcqnWPXtTpH2Z/s1600-h/image%25255B53%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhU3_1t7BIOY5W3O-LR20j0yxCv5QMVXU-G3w2imxKVvAaYZ2L-f1as1jZ-YK59AMQL_-L6Il-46HWcXqNQa3z1-8-kXXt1ChF_X5WPkxBjPhyN-5wbJOsMdZGLx1NQrLJreIlPiPIzGbYV/?imgmax=800&quot; height=&quot;127&quot; style=&quot;border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;412&quot; /&gt;&lt;/a&gt; &lt;br /&gt;
&lt;blockquote class=&quot;bq_info&quot;&gt;
记得在()直接输入{}然后才是;&lt;/blockquote&gt;
然后在{}之间直接写下学生的名字：&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjPrT7axrxinAGCf1ACV7k2BfBQtlSVidlIG61ZrFlXKfHjELKxWTH9BkorceAQy_bKu-UjqzvI1m2Bzy8c8RilhvmSNvbg8MnECTr87HP7znUx4bZBUVUQlosCkORYYQl4DQX6IATvOAh2/s1600-h/image%25255B59%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhAJRkM5XMbNoV5JKPEDDEPhlOipSXifexGxmAGkGOymnTAeceTZNm1DL3zl5VjxYOwKKrXODM39h7_tSnO-cbTdtnyYe18Yu7cpkCjNFcsnWFSjqB5YUhA9AgZ56xRy61I4B3LXIJ_FgF0/?imgmax=800&quot; height=&quot;152&quot; style=&quot;border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;430&quot; /&gt;&lt;/a&gt; &lt;br /&gt;
&lt;blockquote class=&quot;bq_info&quot;&gt;
注意：每一个元素都必须以逗号,分开，但是最后一个元素除外&lt;/blockquote&gt;
然后就可以直接访问元素了：&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi8JN-KzZP4uoCIBdt4L93S1MEKb_xMNPTd2LVeszRLrJyfLZt982ZcfET01xgKOKAsNLoKCxwAx-8vNBjjzuyk28S5TBOslQjSbwQM6haRLiBIVhS2ukrSqAp9MjPtR6kZMpkIv-xxHelo/s1600-h/image%25255B62%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiCyfgtec7ar_sLABiw0nBMzNfD5wCzjtX46RekH7C3NX0FKg4h1CmT6FjjYcDU2wgxjN1DaTdv3_PEWW21MmYnhZQ9JK0VWgFbrfNCbjZCzexA-GEdv3Q4m2MwCmEwJnW8uUIAHEpuaPIY/?imgmax=800&quot; height=&quot;177&quot; style=&quot;border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;431&quot; /&gt;&lt;/a&gt; &lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiK3giq2ZYeCSPd96ldyA1rUc5hQXAam2C2pyOcEPEMjOjyCzlWJ0CEOa8khsz-VaWVMf6dQ7j5gIoNlh4-dPWjMEQkH5ZduRLtQuMB5LOHEgwMHX3ekZEqqbLeZWOajKEaFSWOJEhu5Vc7/s1600-h/image%25255B68%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjzAaW2_0MBKUMHBeolvD0nDTRso_KwNZwZZIzJV7XW1KQ7YdLnlKFc3hROLub9xA7rb6Ej56xTEfTb7U4RksQ11UXS4hLGp3yMC6pqJydpIh6ES1yikWEtNg-Eh5FjlS-aoDtsWUzd0Gdo/?imgmax=800&quot; height=&quot;300&quot; style=&quot;border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;300&quot; /&gt;&lt;/a&gt; &lt;br /&gt;
&lt;br /&gt;
你：如果我要移除一个名字呢？&lt;br /&gt;
我：移除又叫啥？&lt;br /&gt;
你：Remove！&lt;br /&gt;
很简单吧？&lt;br /&gt;
比如说我要移除Bryan&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgBqEblM7fupqufW3wjW7boQCe9qb0yAEHV8qKrDnzcgdA8Hi4Iph2iNwSNuYNdxvFNtVaBd0LEFMp0Qo9m8kmHCCrksiDkUCErGyAXn25FTPAs6HbWdPiyTHfD2SKfaf7QeolsLHxzGZOb/s1600-h/image%25255B71%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhJYRwycNKOdFEux-KIh5f8Zx3cFE6KO-XMKVPJLwWfXeHO7G8uzMWjfMblGfERPfxAQJqfkWwuUqKB4hpuOleGZngFUaiYMVDwdzN52gGojTnb4YVwTJNtlG74mAe2VvXOp53-zsN0-9u_/?imgmax=800&quot; height=&quot;195&quot; style=&quot;border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;402&quot; /&gt;&lt;/a&gt; &lt;br /&gt;
Remove 传入 学生名称&lt;br /&gt;
现在数组变成了：&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg_q1JYE3_Z4ShMw86Kv-TfZPhWSSEHUsd7eL2E8ZsyqtF5kn6mUNLO6y1EJ46pT7cVGBee5cbAkpi0RfrCN3xtqtdO-4lXIImEPRk9hzwiC9s03bP_NFln8u0er_1GSwKX72UCA4399klI/s1600-h/image%25255B74%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiAxIU-dy2OVHBg5K5gp3sYRlwfZj3-m2qKK28XQA4KylEuNPyC7eHvnfduSolJepa1AaG6MMn1RB2FVv0XAtCEbRBu0fK0cy-2yvs-Oc13GRh2kOAvm21rwthCJZ7wLrMI70SG_lY4Yjti/?imgmax=800&quot; height=&quot;133&quot; style=&quot;border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;182&quot; /&gt;&lt;/a&gt; &lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhgeuqkU_4UYonXr7Y-JLl6-8v98qKCdoi61FwmPzpfodinp7y2y1VTPEvebbxoeMvLBkFTFKFPrmy51fr8le3CXaXV-6xcWeXaoxUzGrbBLiVQkPW9mln9RWAwRLTl7Ur74e7Y9XUcKerG/s1600-h/image%25255B77%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhtDVz8KcyHpznp-kx7Qu03wHjCIBg3ezctf1cyt1D_xesCgcN71bZt3sai4pk0gfeLJWrVHH1lmHmQ7QdJxMzFX83Il5RYDMSjJlyrSpWZ9yOOaHdXDLbTJCh71ya1py1kJWtQb5coMTmE/?imgmax=800&quot; height=&quot;300&quot; style=&quot;border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;300&quot; /&gt;&lt;/a&gt; &lt;br /&gt;
&lt;br /&gt;
你：那么如果我要移除某一个为index的元素呢？&lt;br /&gt;
用RemoveAt！&lt;br /&gt;
比如说我要移除第2个元素，index 为 1&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiQPBAku7niNI2t8onDKBv25M-aYS5aRlKcfsqtKY8HuxsRQ82dtV3cKQlDszE43naG3JQ-3cHJa0MuR7fFWWbQVYsFcSqR2hlG0T7TcySUY0wjROJfHYz_DHsaeYccwfF-tMg677dtHGBN/s1600-h/image%25255B80%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjqZNJJcGyby7DCGxlt7AcL8AjA1YaWpDoDt8OSVtIUP3e7DDYI5rwLquKlNzS_jBxDLejuQCMM1xhTzw-UJ6aAJ25GDKdjp3dEFrw0l3Je-9USAKoHlvtySMUZ5gU7XreOFCSZPyiTsB5P/?imgmax=800&quot; height=&quot;188&quot; style=&quot;border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;412&quot; /&gt;&lt;/a&gt; &lt;br /&gt;
RemoveAt传入的参数就是index&lt;br /&gt;
这时list变成了：&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhl2dwEYenPaKmTrwKHa7CcCodkUE-ESBdyQ6BsLkteeUTIki7mLczWMQs5W1SpXpfbcD3VCi6f9CDHHIbOaVIEBKkU7oUGd_ueByl8_Q7wLXE9_A-iQBt7t5J8pf2C3EkkxJY5eiaamkib/s1600-h/image%25255B83%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiQW2yzDcC4wMDXQqH6MP75L85KYfX2YTpovfG183DvRTWonYDjaWMToNv-8jgKD5BpKWzPqdxf_A51ca5VN-Hh2ua-UqyShw4-bnuTiXrVyNl5BPixn7BTcxWO2cQ8MUc0Lcvib1FFNFb1/?imgmax=800&quot; height=&quot;100&quot; style=&quot;border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;145&quot; /&gt;&lt;/a&gt; &lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh4vx9hr58Uv6u-hwpcq0Pg3Y7dTF-8EpgMAdzykCjGw9pZORUKk0mBi2KX3SYLF1dh0fBa7FDRkRHvEiKgRBZtShAF_BNi03jhLYIc6OS38O0uSdwrEtN_Frwcl8JLNS9oq3WIUZ-gv5sm/s1600-h/image%25255B86%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjtNuQGt4uLTMeEkaS_3VUV_d-VicthGFtH4pXIZqp2smBmUxZU_V5VdyyzkVDZn5pptpmHKv7o8SzCdQs0VllQ7dhTT4ufHitdtTUbGhuLxN98B2YbwCDp3npyeLQcFhWqXPBCoLZNbrsD/?imgmax=800&quot; height=&quot;300&quot; style=&quot;border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;300&quot; /&gt;&lt;/a&gt; &lt;br /&gt;
&lt;br /&gt;
你：那如果我要清除整个list的元素呢？&lt;br /&gt;
清除全部元素就用Clear&lt;br /&gt;
不必传入任何参数&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhFHOt3HD9MxwmyYgAVuujEkPWWU7Dg4Ik5uevRaSjz14z7CpYFVrLSOB5yigcu0klL6FGiVv2HG4ws-j1o8boCy-Zj5XM_Q5uy4KVxCc6mdw4vQejR8-y4qJYPFJjPuH9Lbgv-eDFg-Mja/s1600-h/image%25255B89%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjvaoX7xCnQQQuka5saNUzxO3fxphDYBuWc9PkuJmS09BS61yW0UFtEFxuFozdYshcf4sn52d598FRzz7iPaJVrdk9-QNMa7yp-g06fAn01AwT6ahHvSV_ygvqpM_2Vr3T6lOGA9REKzErO/?imgmax=800&quot; height=&quot;181&quot; style=&quot;border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;401&quot; /&gt;&lt;/a&gt; &lt;br /&gt;
这时List 就空了&lt;br /&gt;
&lt;br /&gt;
你：我要怎么获取一个list 的 元素数量？&lt;br /&gt;
很简单&lt;br /&gt;
用属性Count&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiwnjLXqCKGs16S4zz60XXZ3mc5fqxZd8dITy28JHfP0xpocHetKCHFoMxNMLY__8CLt28lxJj-GDcm9zxpOVP5eb7KHk8H4nfXML5IxX1s2Y76boAaCSn4KBuSqXLWBKL4IBTxDUhEiI9k/s1600-h/image%25255B92%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjLIUsifMH0POic6gmEzK5F6ZPcBgcpjPFKbgvLjaNfXVE1coNY1BwTtNeCc1gbp2Feht-WZ1R0fzhPwFZNMIVQB9817MITKqdhZhquhDyOATduBrLCfLl9NWSASTGOL7KNZF1jhfLY58qH/?imgmax=800&quot; height=&quot;190&quot; style=&quot;border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;415&quot; /&gt;&lt;/a&gt; &lt;br /&gt;
&lt;blockquote class=&quot;bq_info&quot;&gt;
记得要将int 转换为 string哦！&lt;/blockquote&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgDed4qASZ0u-0bcRVzSXoRoa0nHyQ3g7MFGBXvPdelcn7v1ode9tnHXoqq4GwvGMlJEE0dhfnzgayDdBtHTUUZ6C5TvTvn-og9D7ofA06ssXQEJh5lanj9uvhAH9QZ7B9DgedM6g6_O60n/s1600-h/image%25255B98%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi1o2qZieBwgmDspxKCX9fRu0g_0KezqFOOqysX34d_G_frBNib-TfY7O5GeaLyAWEfVd3CsWz7tLqJJh8V3hhvk1ssYF_kGLPADoYKOZzVZnDNoCpmeE40jz9cQol9VNQqT3ei0kAj7Gex/?imgmax=800&quot; height=&quot;300&quot; style=&quot;border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;300&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
最后，List 也可以用在任何类型上！&lt;div class=&quot;blogger-post-footer&quot;&gt;&lt;script&gt;
SyntaxHighlighter.highlight();
var linkwithin_site_id = 1130633;
$(&#39;#toTop&#39;).remove();
$(&#39;body&#39;).append(&#39;&lt;div id=&quot;toTop&quot; onclick=&quot;$(\&#39;html,body\&#39;).stop().animate({\&#39;scrollTop\&#39;: 0})&quot;&gt;Top&lt;/div&gt;&#39;);
$(window).on(&#39;scroll&#39;,function(){
if ($(this).scrollTop())
{
$(&#39;#toTop&#39;).fadeIn(&#39;fast&#39;);
}
else
{
$(&#39;#toTop&#39;).fadeOut(&#39;fast&#39;);
}
});
&lt;/script&gt;
&lt;script src=&quot;http://www.linkwithin.com/widget.js&quot;&gt;&lt;/script&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://garyngzhongbo.blogspot.com/feeds/7349484015695388749/comments/default' title='博文评论'/><link rel='replies' type='text/html' href='http://garyngzhongbo.blogspot.com/2013/11/c-12list.html#comment-form' title='0 条评论'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5319618319979683940/posts/default/7349484015695388749'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5319618319979683940/posts/default/7349484015695388749'/><link rel='alternate' type='text/html' href='http://garyngzhongbo.blogspot.com/2013/11/c-12list.html' title='[教程][C#] 新手入门教程#12——List'/><author><name>Gary Ng</name><uri>http://www.blogger.com/profile/00014057672539539340</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEikz96DK7AZSXKxbSDZWfrMJxGgRuoEW6SSysjpFtg0GBSB-FYW5zVfnHBCN3oFBig0WHw9Vr0FzneT5DWRBWWDulgoFf7FlcrOH3gWszkpB6s9XhwEGzyvicxs0M9b3B9s3bpMaaBpjWHj/s72-c?imgmax=800" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5319618319979683940.post-2801442014429745494</id><published>2013-11-25T11:18:00.000+08:00</published><updated>2013-11-25T11:18:42.704+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="C#"/><category scheme="http://www.blogger.com/atom/ns#" term="入门"/><category scheme="http://www.blogger.com/atom/ns#" term="原创"/><category scheme="http://www.blogger.com/atom/ns#" term="教程"/><category scheme="http://www.blogger.com/atom/ns#" term="新手"/><title type='text'>[教程][C#] 新手入门教程#11——数组</title><content type='html'>你：我要怎么把一堆学生的名字储存在一个变量里面？&lt;br /&gt;
这个时候，数组就很有用了&lt;br /&gt;
数组基本上是一个变量，但是变量里面有多个其他相同类型但是不同值的变量&lt;br /&gt;
&lt;br /&gt;
先添加一个Button 还有一个textbox&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEilGsZ3ztflJNh1x7GnOlJQVoabWgae_O1Pza4dPUX1TAjrKQOnpPuab4RbUOrUzxCqV7AiEGxnQ8Sw3WoBJr_aurV_0dtHiycVTHZQNfw2vskIXOufQaMIW5RndS1sr765eo_ViIIA6veA/s1600-h/image%25255B32%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhmxhRX2Dc6E6VT6H1FKfii1Y-nHKGJouvCYwdwgQLS8RWuwv60P2dQmP5SlmYTX0THpibmiW3yLhv_ppbqMKPgKwydMVcj5QCzPlngV8fq4yNJV0yZeDeZIAeH7xAT17xNaAu3GqD_rU9c/?imgmax=800&quot; height=&quot;374&quot; style=&quot;border-bottom: 0px; border-left: 0px; border-right: 0px; border-top: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;361&quot; /&gt;&lt;/a&gt; &lt;br /&gt;
然后双击&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEixSCAUXbFOl5NT-2MeDbKFrpLod-x5gqwALiao0THtygishjEdNQ9sUGb_jBi00VW-Ro_gm9Pk4xPcYCJiXfe-12mpbs_dLBy5ugsR7T2iT0ju0u-dLZFlyS2E23BAw6AhzkdDUoVnw-LD/s1600-h/image%25255B8%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj45Nd9aMfZXIxn6_D6_6-DPwl05Y-2rjZO2ASRMCzA514_KZD8DBntJwwsnxCksRLDfTaqZTZ6twigm5PyaSx3FGwxRSJwl0KfNH1DDUnNaRI5B1lK7ttcojfyduUMLFGPtOwIluLQXGTO/?imgmax=800&quot; height=&quot;82&quot; style=&quot;border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;408&quot; /&gt;&lt;/a&gt; &lt;br /&gt;
&lt;br /&gt;
比如说&lt;br /&gt;
你有 Adam, Bryan , Bob, Chris, John&lt;br /&gt;
5个学生&lt;br /&gt;
然后你想创建一个数组储存的话：&lt;br /&gt;
首先输入：&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjtxMLnh1A8uam-dnsfhshVxBwa0_UDkGipamj9WMdfR8lf7fdQQPpkO3eLgbrtkPu_5XovfYYCi-0kei-pXZHDxPP8U6y-62MIPpZfyUtrf4qX6KOFvvuafVtiI9BACYaipwvh2ywqa7OI/s1600-h/image%25255B11%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhKvnL1e_IH7olwTlIhWCE46x-LSLEoy6OTLf2A9pNLjsFHfWjYy-sSqFTAD4Px7qABdxmFEigHLOvYoii-3AybKDzOo7Z5-Tvz6I5eHNj6Ki4pfwueKroYFIeE-Qiij85PJO9Q2clw1WAg/?imgmax=800&quot; height=&quot;83&quot; style=&quot;border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;410&quot; /&gt;&lt;/a&gt; &lt;br /&gt;
[] 代表我们要声明的变量为一个string数组&lt;br /&gt;
然后就跟着变量名&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgMHKSqmiAjXZ2oaz48PX5_NxYaXgSPLctO6w-i2_PTcm0plpuuZugqKvtIdgBY2llw024PxAEGQH2ilNtYym5m07pNZsI5GnT2Ec9jBAoSPuwlvbjMzjTIasaEuC0rWV1PThXJu9NkNaT0/s1600-h/image%25255B14%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgJ8WtJ4EoOkO3o1ZJPxW1ql7o2TVOslJX-Zz9Y_lAb0odRn8yEZzRNdryKVswishMTZ04HKVsOdzrQ1FswqZX59qwWsIVhOe0uHehQ7rIlbq8ugdbO3VgU3i8ieRng_3-Ly7Xh9fQHVPOg/?imgmax=800&quot; height=&quot;83&quot; style=&quot;border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;410&quot; /&gt;&lt;/a&gt; &lt;br /&gt;
然后在加两个{}&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhj6GVUSccutaAZKLIxgCDy-i2sBJ17sGK0E_yFCxeecVPM2Ir3CX5Ei8r6BA5MahDdnmlVb3_3Md0s-DOQIvfFvVAuOfO9k5NYDcZHLFMTGy1CfbVxsaZ36LiYkZ0tvudsOkn2hGoUbj_d/s1600-h/image%25255B17%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjKXWscjGcolV5L8UWwMBegMozzkW8N4tpt8V8hd5e6LrrHkX16_1uUoz4n5kMfr0mpBxoQW_GK5BxC1H6CbV-FZBiZQNHmdGkJdIcEl3cr6ilj4g_VvUb_BiOjJH9C8jEBDe3p5ZyNG6t9/?imgmax=800&quot; height=&quot;83&quot; style=&quot;border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;410&quot; /&gt;&lt;/a&gt; &lt;br /&gt;
{}里面就输入学生的名字：&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgG4lK2jsXpIVBd1ZYVPUfJULr5JoWr9MdQu2EENM_dm6gT6b0-dbimESOOoWhpHg5nd91SUudLP1G0COutcbVXrl9Uk0quNQDQ3odsNEW12fmiXeo-OmB8fYFz22XaSJ5tlMiwqyqIH-h0/s1600-h/image%25255B23%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi4lcijS8IB-QHY838sBNwwn_nhF5bkrHuKFlNi4uN7LuChXyqfUvtW49UosZgZrc1Ivkdrgx85ZA3U3MVSpd_ieFjClm4wij_VZzBf7bKvy8k3guZj6rnDN4t1VbjlkrOAPADgtegnzUuO/?imgmax=800&quot; height=&quot;90&quot; style=&quot;border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;508&quot; /&gt;&lt;/a&gt; &lt;br /&gt;
这样你就有一个数组变量了！&lt;br /&gt;
&lt;br /&gt;
你：我要怎么获取某一个学生的名字啊？&lt;br /&gt;
数组是这样储存的：&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhYda-CkM3qGsyOSprcKMQXYA1CJo6O_qa6OQBUCq6YdEX0_X1J3d1C-m9N_QAkiPKGRwIrnkuLKYCtQXioZ3hkGsD6hrnD_3gdwxLddzzR1babUEzks1SDnKzdLjv_jwJdbd1mzKYKI-Z5/s1600-h/image%25255B29%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi9kOcgVtSbbOWkn-iVnotycWUqls_5Arfl7XjgPXO_g-AaSIuDY_z8jTr2G4e6cAo3pDO2KGtoX1rkItmmIEiyrxcm8yRDMocPI3ECAsp8_PqREGbVlwwVG6uEE0HOVHTFZPmJSjQru-Af/?imgmax=800&quot; height=&quot;187&quot; style=&quot;border-bottom: 0px; border-left: 0px; border-right: 0px; border-top: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;221&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;blockquote class=&quot;bq_info&quot;&gt;
注意：每一个数组的index都是以0开始的&lt;/blockquote&gt;
如果要获取Adam 的话就这样：&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjW2g6P30214TAo-rF1CEWAqqnwPdo2Zo8BY21Pu1_MDvt_s8_moZKviFd32g9g5HGGi9EH05OFHLRQbLDG8XvxGCrKoeVTIm3nUwwyPluYYsFHC3bWdTUfwtTyo_HcmcAEofbSCsQz5tzx/s1600-h/image%25255B35%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiQ6vsF8D1N_5a-qBc-aPH4PscE0-xqnnfIEpLYFqn9rkWQt9LlSj19M7XQSiTFTQbfmMdLtd3fSYowu5zJi0OkRNYTnPbZ1QonQVzuyKLKulrkU5lHG77lQGE3i29VAhJy_iDllyxEFWLb/?imgmax=800&quot; height=&quot;98&quot; style=&quot;border-bottom: 0px; border-left: 0px; border-right: 0px; border-top: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;509&quot; /&gt;&lt;/a&gt; &lt;br /&gt;
在[]里面就是index&lt;br /&gt;
因为Adam 是第一个&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjSXs_J_I2mps4kV7K_JxtMHoMctw99_NjuX6mYtGzzdGm2MLlPgidTiMdcgRcPj2Oh4u768FuiGM5cjP4SnrQXuTVxr4BQx_28M5Wu8AfGXbl_xXw-XmVV2dWF5mti4c_EECqPZ-WRzS2Q/s1600-h/image%25255B38%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgKlvL-WiQ2qrG4hS5XOvuOqSPxvPbRy2pQg5bIJ5d8egPWcQIicTFPPnbkpT6QBTTRLEAoXPMqR9mYP5mzUzVvmpv5ABjdvpUA_4z4nH5dR9TeeVhKFEpauqrAFoHnuh5u5hr3ADq9Ua9s/?imgmax=800&quot; height=&quot;300&quot; style=&quot;border-bottom: 0px; border-left: 0px; border-right: 0px; border-top: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;300&quot; /&gt;&lt;/a&gt; &lt;br /&gt;
如果要Chris的话：&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj6sfnmlqNegRm-R73Sf5CfO3eSDHCn3wtwOTWKgpHcfKzBy2M-o0LWXc2YEXDum9OqAkx90MdfNL6ltEVEy3JtGDgToBvX2JG9A8u878gLAx1OCnk32uRwbj2N0gRkCCqfxgB7PBxOIEIE/s1600-h/image%25255B44%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgPmPglG3wWpurIoZB4A-7j6fFOH_-v0CoBHVw4TMTL4gF2o241lHecsjehzNS4U0iUI05x9XbLi603UivgA6JT-cKqG5cQdFRJXT532Z_4LKCsvfrZcr_L5b2m5SEDofMitcIRkuEPiDkZ/?imgmax=800&quot; height=&quot;94&quot; style=&quot;border-bottom: 0px; border-left: 0px; border-right: 0px; border-top: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;507&quot; /&gt;&lt;/a&gt; &lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiEGdOXSyWDbLNPsK6nMzlhEx7G5yUP-ntkLn8H2r4gGC6cVab5WS0q-K4mlrLJAt_3l4SmR8o__zR1g83oyeO9pfJpe-8VTbge05w1rwyP2B4ZlEXrCXVNQswy7VC5nd2bpcRIOtck0HWg/s1600-h/image%25255B41%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj9c3ZEh3ajWbcPv1w9K1sl5J_T7bsrBMFujOLjvQjuQUyi3j3ZeVafc7p8OyYQCLOHeqQbGzKAAOYYkb95j-2nm7h1vLc9lfWYq2-JwI2ynJaYvDo1s2_-_WCRM8Z5_KQGaSaxHgZUpaTi/?imgmax=800&quot; height=&quot;300&quot; style=&quot;border-bottom: 0px; border-left: 0px; border-right: 0px; border-top: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;300&quot; /&gt;&lt;/a&gt; &lt;br /&gt;
&lt;br /&gt;
你：如果我只要一个有5个空位的array呢？&lt;br /&gt;
就直接这样申明：&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgvzKDPDFGAAIrkrqOXS5fYuBN6n2YfOj7eZlMVvPcRavisvoOoWMM40xCkcPHmCkl8nhH9_rdi8OXGHZg-5X_69Xafsx2yN5iQ_dYGh6QDfOuXOKJXxIWFwqz71ko7h-Ceei_Rxlr_HQwr/s1600-h/image%25255B47%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEitrXqOseHWmBpdFsjkRz1W1sp7Q-1L37h6I4Y17D3fYX4iJe_9IDDE_buxji0f1W_hRqP3k0o7ft9N-aA0DzpFC0kT8NgqP53WrK0qjneJrc4tOPO6vrFW2XL7s0cAM5_rv9dd1BQw2dOA/?imgmax=800&quot; height=&quot;82&quot; style=&quot;border-bottom: 0px; border-left: 0px; border-right: 0px; border-top: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;417&quot; /&gt;&lt;/a&gt; &lt;br /&gt;
[]里面跟着整个数组的数量&lt;br /&gt;
如果要更改某一个数组的index中的值的话&lt;br /&gt;
直接赋值就好了：&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjjddrq4a0YpwRZ4aE3b5l0avlPhubCcW3kn6EeaUTXfKmnHKPpz7uJIxYOvgRH8axKD1xLtNSv7CspHserXTKvRVtjBwsFo0euA-uD_TQhzEr9_eP1hsu0iQgLB9M7oM-LbyOA5sc8CJhT/s1600-h/image%25255B50%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg-Yxuf7OiZj9IOEk8XSx5-W8qAyZYMynNMxKbpAjGf_d7W8GkPwNFzBoOujPL-nDE-lwXSh-d5hBpNlCrmhG0d57TDhEnbFDHv_egTyl9rOFpr3fqfR9Jc74ukznX5g0Ia-0tF_U-xw6Ls/?imgmax=800&quot; height=&quot;109&quot; style=&quot;border-bottom: 0px; border-left: 0px; border-right: 0px; border-top: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;428&quot; /&gt;&lt;/a&gt; &lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjdPq_NJmD366bxSVkTUwoLjbHw8U4FAYlArsgp9od3vGyBpUVlauog_bnN758Bji4Uezr_IsLi7QYRwc36U9Hp4fFkynSI-0dXh1KHuHZvvz3m8dh_jSwGIAWyh0XMz6UbvIGpl67K-Iw-/s1600-h/image%25255B53%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhX7OgMlAgRXvnfqZ-1rFVoDWHip475bjFwMIkQ9E2GHP1dc31DN9OiJuwhY_QmOjsPVkRlgqL2SrEjzmFDtB3KOxxlWv_soahcZMyuwq_uga7Bm5mmxGZH3YnsAyJ7TqrrzU4oYa11puvf/?imgmax=800&quot; height=&quot;300&quot; style=&quot;border-bottom: 0px; border-left: 0px; border-right: 0px; border-top: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;300&quot; /&gt;&lt;/a&gt; &lt;br /&gt;
&lt;br /&gt;
数组不一定要string&lt;br /&gt;
也可以其他任何类型，比如int、bool等等&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjDNXx0ND56iWDIGVU772tKgJGZm4R9QYrxFA3VSdkpVbtbwD0p6iZ3Cl9fBP_9EKVb2lE8OpSdvsvNnPRYYXGCHfwcw_QkiCf40j2wDci5hFlZ0gcMilhhuKq61M3gxbXje-vuuEU3Gmmw/s1600-h/image%25255B56%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiff90Fo_MzfSGt_Yool1pdb97h3n_13PiHuqTBQRY9cnCGyj0GzkfrFsIr3iH-rbZAqj3VJ_s-fP1FRlc57zj47orRYse5tHlcVW4o7mhlls32RjUwMq0foUfJrCX1QoItuPfxcdeFnCwg/?imgmax=800&quot; height=&quot;108&quot; style=&quot;border-bottom: 0px; border-left: 0px; border-right: 0px; border-top: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;414&quot; /&gt;&lt;/a&gt;&lt;div class=&quot;blogger-post-footer&quot;&gt;&lt;script&gt;
SyntaxHighlighter.highlight();
var linkwithin_site_id = 1130633;
$(&#39;#toTop&#39;).remove();
$(&#39;body&#39;).append(&#39;&lt;div id=&quot;toTop&quot; onclick=&quot;$(\&#39;html,body\&#39;).stop().animate({\&#39;scrollTop\&#39;: 0})&quot;&gt;Top&lt;/div&gt;&#39;);
$(window).on(&#39;scroll&#39;,function(){
if ($(this).scrollTop())
{
$(&#39;#toTop&#39;).fadeIn(&#39;fast&#39;);
}
else
{
$(&#39;#toTop&#39;).fadeOut(&#39;fast&#39;);
}
});
&lt;/script&gt;
&lt;script src=&quot;http://www.linkwithin.com/widget.js&quot;&gt;&lt;/script&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://garyngzhongbo.blogspot.com/feeds/2801442014429745494/comments/default' title='博文评论'/><link rel='replies' type='text/html' href='http://garyngzhongbo.blogspot.com/2013/11/c-11.html#comment-form' title='0 条评论'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5319618319979683940/posts/default/2801442014429745494'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5319618319979683940/posts/default/2801442014429745494'/><link rel='alternate' type='text/html' href='http://garyngzhongbo.blogspot.com/2013/11/c-11.html' title='[教程][C#] 新手入门教程#11——数组'/><author><name>Gary Ng</name><uri>http://www.blogger.com/profile/00014057672539539340</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhmxhRX2Dc6E6VT6H1FKfii1Y-nHKGJouvCYwdwgQLS8RWuwv60P2dQmP5SlmYTX0THpibmiW3yLhv_ppbqMKPgKwydMVcj5QCzPlngV8fq4yNJV0yZeDeZIAeH7xAT17xNaAu3GqD_rU9c/s72-c?imgmax=800" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5319618319979683940.post-8902018003450098921</id><published>2013-11-24T12:09:00.000+08:00</published><updated>2013-11-24T12:09:55.506+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="C#"/><category scheme="http://www.blogger.com/atom/ns#" term="入门"/><category scheme="http://www.blogger.com/atom/ns#" term="原创"/><category scheme="http://www.blogger.com/atom/ns#" term="教程"/><category scheme="http://www.blogger.com/atom/ns#" term="新手"/><title type='text'>[教程][C#] 新手入门教程#10——数学运算符</title><content type='html'>&lt;p&gt;你：要怎么做加减乘除啊？&lt;/p&gt;&lt;p&gt;其实很简单&lt;/p&gt;&lt;p&gt;照着写就好了！&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;先加入一个button 和一个 textbox&lt;/p&gt;&lt;p&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg7ZW_7hIDL6Su0BwrlOt5YjcoaFxMTRFwXijSuqDEKH4SrrXZRKsx8gGIpO5NUI4cSPs-5TJrpfxzrHW3uAAO0d_7jRaPUpU2p1cvRegM6D1T4rcEH_VnBH2uK0zamRqBnmshxsQJPGnlM/s1600-h/image%25255B8%25255D.png&quot;&gt;&lt;img style=&quot;border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px&quot; title=&quot;image&quot; border=&quot;0&quot; alt=&quot;image&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh1moVFtd4LLXZuHBWciMM8UgceJBy-u0E2MUwGAizmUOZB91t7HYqYiyU01OhUiDVtN3-fI4fdM_HnGrpZ4ixhAhUDS7PDHGwrPzNU4Wn1IS2A438yBr67WZTuWciEqun7grcGRWhez9GR/?imgmax=800&quot; width=&quot;341&quot; height=&quot;377&quot;&gt;&lt;/a&gt; &lt;/p&gt;&lt;p&gt;双击button进入event handler&lt;/p&gt;&lt;p&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhtYZ3nvuLRKQXJEelGYjF6zJyQ3Q6VO5DVjLeAUH5UmPYWjC6KdSZkU6xejUyrEzbCB53Wbrs5l8kE2F6YtMkldxS9yH9JajBO9To8B5lBuyKEKGEM7ru4TOPB8b86358o7ZYHExVRVJEb/s1600-h/image%25255B5%25255D.png&quot;&gt;&lt;img style=&quot;border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px&quot; title=&quot;image&quot; border=&quot;0&quot; alt=&quot;image&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhPP3tiJW8iinANqlf1vnvCvPWJGsc0qy0mAPHTyCeQ6DqHnWPtUEF85rOsIYkLnLahOOk6woZieD7084bbrElmQiQy8gpb1YrsFvX3zsQpcL2E26WaN7GoKksGtctKdlD5_cdCNW8BKS7O/?imgmax=800&quot; width=&quot;453&quot; height=&quot;78&quot;&gt;&lt;/a&gt; &lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;你：我要2+3的结果出现在textbox1里面！&lt;/p&gt;&lt;p&gt;就这样：&lt;/p&gt;&lt;p&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiHVPclSxzQPHnGb3_ZBKwhNJXuNTgUQhtFE7hbUdWqiKnLuKx0mpWnQtNF3GbDSNumnwkvqRJHFJB4NSJraS0Lf6kPSjo2kpbNJ70bitLRlee5Trrx3NlPOJ3WUIhiYUbNkTA-yEHvMi4A/s1600-h/image%25255B11%25255D.png&quot;&gt;&lt;img style=&quot;border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px&quot; title=&quot;image&quot; border=&quot;0&quot; alt=&quot;image&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhkll-cGjMmgGU84RnsF4pktMBrWjB5IGeZFRfFUwNRaQO6AQzwex5sP5odl15TtPSpsOw1PvlNbzBFDEcahQen-IXkgfudMGioPx50DvHtpkLqk1exqHLMNlxH5iyXFf3fDMEDlgML3fWv/?imgmax=800&quot; width=&quot;421&quot; height=&quot;83&quot;&gt;&lt;/a&gt; &lt;/p&gt;&lt;p&gt;但是你会发现到又报错了？&lt;/p&gt;&lt;p&gt;为啥？&lt;/p&gt;&lt;p&gt;很简单&lt;/p&gt;&lt;p&gt;因为&lt;/p&gt;&lt;p&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhZUMuUdL6PWdt2E9O-AHkt_fJ6xB5qhIQW04kuyhlKHX8AkW8RjIv4KdU2Bn4uIXj9QhTCJjPElh6H1bFIvKR_Sdo-ITA9Hz_fcFxf2n5zd18nkMeEFyynmINxZ_NZHZBdtbVtcjS9TF-R/s1600-h/image%25255B14%25255D.png&quot;&gt;&lt;img style=&quot;border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px&quot; title=&quot;image&quot; border=&quot;0&quot; alt=&quot;image&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjKanszZphHn5-WJTq-UxganfVFec2xfqw5sNHAzEklYCBuD99Jn5PnhjHGgxpEls0P03Av9IY079JGmasV5ZG75j3LEWACXWAco7cas2SwTnykClIpvBi-zg8cH5xZfSByvvo0OMZgTyNx/?imgmax=800&quot; width=&quot;399&quot; height=&quot;94&quot;&gt;&lt;/a&gt; &lt;/p&gt;&lt;p&gt;int 不能直接转换为textbox 可以接受的 string&lt;/p&gt;&lt;p&gt;所以我们来转换&lt;/p&gt;&lt;p&gt;还记得用什么么？&lt;/p&gt;&lt;p&gt;.ToString()！&lt;/p&gt;&lt;p&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjaEj3ksBDrI9MdPfrvFUYOZtApJL_JDijBFcYsmg0xLoJ1Toybxt-xX25Lc1ZTTxbBZpOEyH23DLkH0cqzmiWcxtyqJjoLWPAKbmIXL4Bh0S1IvshHl81VVzjSa5p0dE2MpFJE9CebyL2E/s1600-h/image%25255B17%25255D.png&quot;&gt;&lt;img style=&quot;border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px&quot; title=&quot;image&quot; border=&quot;0&quot; alt=&quot;image&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi2gHpOwE-SKZbTGq0FJl4i3kd9Tn69Aw137UjNQ9JItzODeK0mqm85ZnxFOS2NEti3Q3RERtB5ClEh-i7AOOC4qpuJbnFG6h2soAimAwuhZE3iFC7zv7jG8AmBw9TcFjX1XsN_s4zdQuih/?imgmax=800&quot; width=&quot;406&quot; height=&quot;105&quot;&gt;&lt;/a&gt; &lt;/p&gt;&lt;p&gt;如果你要更加简单的方法：&lt;/p&gt;&lt;p&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhz-ijOSxo9W6wmio5x0LhD35WjN825bkQBS0VPBTijFKG5XGpxjx9w7SU_Ef4TB8yaagfpA2jCnYHHXXkt92p7LxLwBD94s_mIdq6LRUVIMOhqw21Rg8FAHafdcRw24MNQhNZhuTKinNHq/s1600-h/image%25255B20%25255D.png&quot;&gt;&lt;img style=&quot;border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px&quot; title=&quot;image&quot; border=&quot;0&quot; alt=&quot;image&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgtBK0hDnQwiZpFe4wbU2H5Fjf9pxkSGNBA2wBOoLbb6q50kItax1CXrSESUlCoLZhmm7KgZ-k5-G4s19g58pO1FRoHZ964ILgN_pShaANnN709UGe7KPh55bMxBFLC4wmA6TbJN4PGafxI/?imgmax=800&quot; width=&quot;401&quot; height=&quot;79&quot;&gt;&lt;/a&gt; &lt;/p&gt;&lt;p&gt;也行&lt;/p&gt;&lt;p&gt;运行看看：&lt;/p&gt;&lt;p&gt;点击button &lt;/p&gt;&lt;p&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgeDIEgjdL4J_9tX28r8nAvJ4ccIxQmsq0nVIWdUy0WM3jDS6-L1ydoUOsllY33P7QS1fVw4ncWLKssVqn9xAbeXl5Izj2h5GOooEIBOdAf5rHAWOhVDDHJWN2iWUcunoDbtYqplIbx96wY/s1600-h/image%25255B26%25255D.png&quot;&gt;&lt;img style=&quot;border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px&quot; title=&quot;image&quot; border=&quot;0&quot; alt=&quot;image&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg3htnmh8cLeDawbZc4fkt5ce3TBQIeajbH9TVJRx7M8MUUhy1FwpTHQi2BdAq1WcCX-mcBlNbiKUINzbH7c5qe35e-y6geRqIrKgU64NlPGkjj3Y2H0lk8xgzMlSP8d9yuCa2gMo5JSi3b/?imgmax=800&quot; width=&quot;300&quot; height=&quot;300&quot;&gt;&lt;/a&gt; &lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;现在你懂+是sum了&lt;/p&gt;&lt;p&gt;那减乘除呢？&lt;/p&gt;&lt;p&gt;就是-、*和/咯！&lt;/p&gt;&lt;p&gt;像这样：&lt;/p&gt;&lt;p&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi3dvpYsBYprSnewqeqLrxHeiWJof34PMdS08K3B8UjA0AN7I8IhFmUwq6MT3Xdn7kRmQhKBSp4afJh3uY6KCBYGwHJt4w6lWi-UOlCSuCRp7xDb0m5ADQkWWyLbZASy4ZtiKH7HdANqVXH/s1600-h/image%25255B29%25255D.png&quot;&gt;&lt;img style=&quot;border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px&quot; title=&quot;image&quot; border=&quot;0&quot; alt=&quot;image&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgM246jw7RtaSsosvpxyfBRSG6JvqEf6nPhF0nNLM-INCmnLvNH0k1dg7eppMhYoohGB6bhkpPXFkooDDVhWGzugJILZOz2ep0bUvcq_7vPDkSjF_L68v_HCdcYimLTVi7XBjUel2xAKS3s/?imgmax=800&quot; width=&quot;350&quot; height=&quot;351&quot;&gt;&lt;/a&gt; &lt;/p&gt;&lt;p&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEifqJcrUcDMfx9eZ-I8SbL3ZnEUU8IsUyj19G5GDkIR1R_se9QpboL19dNE-sl5_LsJrIOqVykqNgUXRS3PXfwMU1qBO_YbztMW5Z9kv_0rpd3jrM5Cm9ThA4K-D_7ndL73R14kBt8GheVP/s1600-h/image%25255B32%25255D.png&quot;&gt;&lt;img style=&quot;border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px&quot; title=&quot;image&quot; border=&quot;0&quot; alt=&quot;image&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEilAgD5r512ycdVR9gKz5tyMcWbKXEGguwyW5JtUfGvbh05QBYm3zo4P78eRk7r-8QtVZ-YSn6KqpisDVRwONTSxIpiaZBaQ8SY0lfidruqyeoeXBYajCGX8N528dIwe2_vzSSCooQvOXcl/?imgmax=800&quot; width=&quot;495&quot; height=&quot;329&quot;&gt;&lt;/a&gt; &lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;但你点击divide 的时候&lt;/p&gt;&lt;p&gt;你得到的结构却是：&lt;/p&gt;&lt;p&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjwqqYbUbFCwVZuz-_Xd3-PjMKpEehcpAC0qDi0z6VMLLwZWR2YmUTk-DR-pcbTVC_6DsLC8bTkmhVv2jUAfufRCnsayDyhrBmkZga_Px9xGmBkdkHVRj8Fk1rl3cjxm0C073f2Dzz5vhr9/s1600-h/image%25255B38%25255D.png&quot;&gt;&lt;img style=&quot;border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px&quot; title=&quot;image&quot; border=&quot;0&quot; alt=&quot;image&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjXw-nq39GenuiowCp-78qke2RLh0ppGajs0Sf0Y8fgRb0_XC_NdvzwafCuvwumCCXf8uysT63fpT6K7a042OCZyD9Lk0CbSh4qFxTnU644IjjUIL9dcpHjHTkYqHGOY1kkJKdwWZ0yskiC/?imgmax=800&quot; width=&quot;300&quot; height=&quot;300&quot;&gt;&lt;/a&gt; &lt;/p&gt;&lt;p&gt;0！&lt;/p&gt;&lt;p&gt;为什么？&lt;/p&gt;&lt;p&gt;因为integer不能包含小数点！&lt;/p&gt;&lt;p&gt;所以我们将它换成一个Double：&lt;/p&gt;&lt;p&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj2tJrK527QpRlrOPmCBuoHWpfouMlijyoZxGQHxH2lkd_KqmExPCj01WHpj-TXRIDGpXND8FVaJUNUtCae5VCNM8MI33zYtXmLdl2RF-OluKOwRHn1Rh6j5xCVKALPekvLJo1qrv3gfOIG/s1600-h/image%25255B41%25255D.png&quot;&gt;&lt;img style=&quot;border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px&quot; title=&quot;image&quot; border=&quot;0&quot; alt=&quot;image&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhgVR5nHQKWDUfYca28KBKOO3ZCfK8P0SiqDC-Pj2m3qjxRzBNcVz_1MNnagqCtzeJbZrlZXx10lBp9d8BeGZF1ZBk4_HEUSM8Rm8A_Tw1sy6X64uBXm0EtRD2WF0-TAXaLgEZAHHsNv-2n/?imgmax=800&quot; width=&quot;408&quot; height=&quot;111&quot;&gt;&lt;/a&gt; &lt;/p&gt;&lt;p&gt;或者你可以直接这样（suffix）&lt;/p&gt;&lt;p&gt;这里的D就代表2和3是一个double&lt;/p&gt;&lt;p&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj0ClrOa6o35wvhkn3XARwNpBoGUWkQds8u4j-GuES_qPgymHs0ARM4N9XlbQD3__O2CGE-cizoqavYKVKk_CxkcgLcws8p_xbEcuzXBASfI8Bc7w0Aw0DEfPkelozsAaTS70n1TRqOdTdw/s1600-h/image%25255B47%25255D.png&quot;&gt;&lt;img style=&quot;border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px&quot; title=&quot;image&quot; border=&quot;0&quot; alt=&quot;image&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgCGtThT3oSULNadFq-ClKjJmDo95ykiEIB2jAn9ISZlEoChYWwyh1wyb379evSLTNc6yKKBlM1qJZWBGQzApMWCj6eoz8qAhFyr1KH7hXRpayBVn-2SLxvUmYtCYDbub6ZEM9va8D7Y2zX/?imgmax=800&quot; width=&quot;417&quot; height=&quot;97&quot;&gt;&lt;/a&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;然后结果就是：&lt;/p&gt;&lt;p&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhgTH6Fj5d8b0mNtF4JYwVGahL8Av6pKPooGVpgLU9csVC02MnzykuUPkbp7zfZ7S8HqK5z2SkHqwOqLzR_jWooaKg1-Kar8uvScc0NVCDBd3iSW_4f_Qmff5NF0A4cRYbEmv0rk3OA86jb/s1600-h/image%25255B44%25255D.png&quot;&gt;&lt;img style=&quot;border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px&quot; title=&quot;image&quot; border=&quot;0&quot; alt=&quot;image&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjILjVttXPHkABuAL0tJ-kq0WS2R25Dz4W0rm5FLddWV-H3TKJrVrCQe5dfpZvuKb5iCKFKV6M_lmyc4k4KajkuJwrmLAgwNnu8FrJYQavhQ55gpBHeISip2B38NznTvelUNHxyAuRAKZKe/?imgmax=800&quot; width=&quot;300&quot; height=&quot;300&quot;&gt;&lt;/a&gt; &lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;Suffix列表：&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;div align=&quot;center&quot;&gt;&lt;table border=&quot;0&quot; cellspacing=&quot;0&quot; cellpadding=&quot;2&quot; width=&quot;400&quot; align=&quot;center&quot;&gt;&lt;tbody&gt;
&lt;tr&gt; &lt;td valign=&quot;top&quot; width=&quot;373&quot;&gt;Long&lt;/td&gt; &lt;td valign=&quot;top&quot; width=&quot;27&quot;&gt;L&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt; &lt;td valign=&quot;top&quot; width=&quot;373&quot;&gt;Double&lt;/td&gt; &lt;td valign=&quot;top&quot; width=&quot;27&quot;&gt;D&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt; &lt;td valign=&quot;top&quot; width=&quot;373&quot;&gt;Decimal&lt;/td&gt; &lt;td valign=&quot;top&quot; width=&quot;27&quot;&gt;M&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt; &lt;td valign=&quot;top&quot; width=&quot;373&quot;&gt;Float&lt;/td&gt; &lt;td valign=&quot;top&quot; width=&quot;27&quot;&gt;F&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt; &lt;td valign=&quot;top&quot; width=&quot;373&quot;&gt;Unsigned Int&lt;/td&gt; &lt;td valign=&quot;top&quot; width=&quot;27&quot;&gt;U&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt; &lt;td valign=&quot;top&quot; width=&quot;373&quot;&gt;Unsigned Long&lt;/td&gt; &lt;td valign=&quot;top&quot; width=&quot;27&quot;&gt;UL&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;现在又有另一个情况：&lt;/p&gt;&lt;p&gt;如果 a = 4&lt;/p&gt;&lt;p&gt;然后你要 a+5 并把结果储存回 a&lt;/p&gt;&lt;p&gt;你可能会这样写：&lt;/p&gt;&lt;p&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjHNJ8PxCkKmrwk9DS3p-NgGdL3rrpYiu5WxeWCMe43kWPGNzcEaXxjLDdVC8TXe27hwOI_et_ztGt9XFtSa_VY-ORVZFBtgoeoGg555ZTJybShA59je7_5Ttcik3rcyv7lteLQyqcDCQwF/s1600-h/image%25255B50%25255D.png&quot;&gt;&lt;img style=&quot;border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px&quot; title=&quot;image&quot; border=&quot;0&quot; alt=&quot;image&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjviJpwq6hiiTVTA0RT-nPKsr2NBBszn5p_QlzG_j6RLACu5FCROLCao1VHz1ZyV_vgd4jb5vP0BgybEzfUo_Uy791dCo1xgvw4khl7HyVk0JnWnh5cbZFc6YDjcRw9ZDxcth0o8yR68YX4/?imgmax=800&quot; width=&quot;410&quot; height=&quot;98&quot;&gt;&lt;/a&gt; &lt;/p&gt;&lt;p&gt;但是&lt;/p&gt;&lt;p&gt;不觉得写两个a很费力么？( xD )&lt;/p&gt;&lt;p&gt;简短的方法：&lt;/p&gt;&lt;p&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhV9YGlO73GydfZLgXGbD4XnDrs5vVC6ZNczKwqoe0jm3wLQ37n_ngjcUnPsqdvYraP587BTaBCiR5JPq8hdO0izxKCAdpmUYFoodT6TMe_sLrgqONb8nkmdIHmGA-0FFkb7PO4OLzdz8Il/s1600-h/image%25255B56%25255D.png&quot;&gt;&lt;img style=&quot;border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px&quot; title=&quot;image&quot; border=&quot;0&quot; alt=&quot;image&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEguTid-1By_rdgN04PEeKe1SrNE4F9X0LZoRUChG88UQQ4Zt_YGy3cqLm-pDzGjfCV6Tgy_DWtYNg2qROECTNtM27GduxPPficfkD6C4WAvb0h25iB3gNsvGlEQx9zyduJxQL49WuurbrUJ/?imgmax=800&quot; width=&quot;416&quot; height=&quot;117&quot;&gt;&lt;/a&gt; &lt;/p&gt;&lt;p&gt;你一样会得到8！&lt;/p&gt;&lt;p&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgVeHkM3KK_uEYCTv268IvRZOoXyKpg_RGtCJebxY3PJi2MjM85Y0fuEL2BJXppYDtZFSOjOIYWsIHKD6G9Q9TZwetkx5m6EHzXM_zAkzs0t4o7FfyBjqTuPmEPZx0bbh-n7w4-8D9s_Xks/s1600-h/image%25255B59%25255D.png&quot;&gt;&lt;img style=&quot;border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px&quot; title=&quot;image&quot; border=&quot;0&quot; alt=&quot;image&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiHTkxSE5Uy70mmyfYAHEwLgiZKD8evhiOZa07sie2Nudx7YjuYjW1XJURJNrFPs4dB9Y-1zqX4c8fk4kHjU0bb8PpDqqWrDqg9QLEipX4rYtbCpr2ftMTvo3-Zgv3L12CrNxjpBDZjgLWH/?imgmax=800&quot; width=&quot;304&quot; height=&quot;300&quot;&gt;&lt;/a&gt; &lt;/p&gt;&lt;p&gt;同样的&lt;/p&gt;&lt;p&gt;也可以用在加减乘除上：&lt;/p&gt;&lt;p&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjb0ySc8nUqd4OM7JeaK60nf0zCtD0N-SBy21h_Xa-i7kT3x52mUmSCyxr1sjiUcAO-M6NwMAfBlAOmRZS4-MJexcmFJzpkSo4jvrZIvkpsMLkKRECEkCuh_bQOYs1UYfiF5ZJ0h3qFBGpF/s1600-h/image%25255B62%25255D.png&quot;&gt;&lt;img style=&quot;border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px&quot; title=&quot;image&quot; border=&quot;0&quot; alt=&quot;image&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjZNTwgpixyLn2Ff4KDVW9mSa9KIpmv26Eaqa5BDD5vk6Ss6ykfHbkTOK9IVdI5cRHib34GfXxbVCM8PQIv1HeLwJnPOimdm8qIQKJCurvfuRfZloYhU8cPDOjBUeXDAhXiBVGYKxdkrvZ_/?imgmax=800&quot; width=&quot;408&quot; height=&quot;259&quot;&gt;&lt;/a&gt; &lt;/p&gt;&lt;p&gt;4+4&lt;/p&gt;&lt;p&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhCYEvAceG0XEENk7mvbMoICDTl0ZxaTDAWAFluynPH-mvpwx-FiE5mHhXaelhlVuV8t4HebNR6zHkBRRvbdW-Q2DhBwEIgns1rj-5Z518k0GN0qGlI_YfYD4fY1NxpnZRL3hkm9hjpRFW4/s1600-h/image%25255B68%25255D.png&quot;&gt;&lt;img style=&quot;border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px&quot; title=&quot;image&quot; border=&quot;0&quot; alt=&quot;image&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgRaHXnQXh10oU6LN8mj4wFB0PwaBUyuQOSY0OZ-zAntHLK_s2EP2pTq9pOIFfgkwXKb0D14ESxiDOM9gOxBh4GJF_Qyv8PCwd7eCmKFZc52xvwC_Fd3gxxyNqVIo-U_SKuM7EznjUwY1KL/?imgmax=800&quot; width=&quot;300&quot; height=&quot;300&quot;&gt;&lt;/a&gt; &lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;8-3&lt;/p&gt;&lt;p&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjeXqYZ6-uIerNQ-51PuYXCqXNMya7j1UZhB9VjfQ-vZIYsuXF9kehzK3UcIbfWta7AsE2QgJLCTF3LcGmcxshRf4_zSdkstaB_L8n4dvFsYVwgXK0fZAkNEl6Ft-uOx7pdH5r4zN2fMTaK/s1600-h/image%25255B71%25255D.png&quot;&gt;&lt;img style=&quot;border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px&quot; title=&quot;image&quot; border=&quot;0&quot; alt=&quot;image&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiHwPU9vHsNaYHXEvXlasvs1SxKC4CcQlMU_dzsgzKfQNtrc66KYeMz_hMdeaPXDc2qeiGG7DatVn1_JI8ncg54GcUP7S2cuT13UCK89MhfX0ZXKm7wTXCJIe3kSCLENba0xWcvVmg5_O4P/?imgmax=800&quot; width=&quot;300&quot; height=&quot;300&quot;&gt;&lt;/a&gt; &lt;/p&gt;&lt;p&gt;5*2&lt;/p&gt;&lt;p&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgH6rYiXBKs9vYKE2RddLCkFNFLbLuwPSawjQIHn9hUvL0gg5bMs_CL0MFDfMoSZWoKux2KM6BcYPk9h0fNyP2b3Y_nqa_HD7zadpHVk_srUFNTlSwDO3WqazGXrUORCHxs2x59Uz-Mh3Mm/s1600-h/image%25255B77%25255D.png&quot;&gt;&lt;img style=&quot;border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px&quot; title=&quot;image&quot; border=&quot;0&quot; alt=&quot;image&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgQqBgboWkbEtRaQxqEUg5yw2_owNXhDDctIOywcio4t6LbuPEnk0M52tQ8yN0vtfmN4BxDZRP6NzrLV1SNKeA0LwN_rSiEHR_8hA9JbuAyaz0ZsuDrEjPS6yZGIKYMSMCpr4icYsBhiuX5/?imgmax=800&quot; width=&quot;300&quot; height=&quot;300&quot;&gt;&lt;/a&gt; &lt;/p&gt;&lt;p&gt;10/5&lt;/p&gt;&lt;p&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEimIHX4FIa528-ZF_5wcw9STdwQ226ApWQrhi7uuJ7R_CA8N0l4MaKj5Vd6yhaeVUKWx8P0FFOI_ZvGHbMFrKTfZ00kMas6B-k1BcWy0VxzK1lf5TCJqDFYm0c8jRdPy5z8MveBAbvs-ZYR/s1600-h/image%25255B83%25255D.png&quot;&gt;&lt;img style=&quot;border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px&quot; title=&quot;image&quot; border=&quot;0&quot; alt=&quot;image&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhBja6JQklEYv6TGxRHv-WJav3IN7s4zJKtCnwIi7FypWfhfOjEzfcZUufiYsCz0XDq2ewfT_52ER9F44gi16I7rL2gcz2JqfgclOFiGkhenvNOH59H53k65WYT3YWNvMNhZDlSFqE1rgdj/?imgmax=800&quot; width=&quot;300&quot; height=&quot;300&quot;&gt;&lt;/a&gt; &lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;还有就是你只要将a增加1的话，你可能这样写：&lt;/p&gt;&lt;p&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgg7_wGJBJoSx7uTUuf5hPgPRjDZQAwA727tldKr_mwh-k5VRS7haK0kz4w2ZMFENa-iHY9S5JDHN8tEA-g4dVQ1aAcXJD2BQmgG_rv9xDOsvTN46cpuABJOmVDW1tijgCypMCsbCAkRYm1/s1600-h/image%25255B86%25255D.png&quot;&gt;&lt;img style=&quot;border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px&quot; title=&quot;image&quot; border=&quot;0&quot; alt=&quot;image&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjv6RNJxZiWQvkD5tR61nMYkCHz_0ocPgnNtYEuha_qogKfP4hheW6f8IPuaEdg1jLFJw1vYvBsFEFl4ji9YoLcEa6n3XbtL5dtVcndOMANxp5lJ3YTmKbKi3xgjiFOxRIDOkIjrfqdvr1j/?imgmax=800&quot; width=&quot;416&quot; height=&quot;145&quot;&gt;&lt;/a&gt; &lt;/p&gt;&lt;p&gt;但是还有更加简便的方法！&lt;/p&gt;&lt;p&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiTw-kZdSdprHZrdvdXgpJ-Dgwze8hG4r6weajnDNsamjV4AUB5o0ZwsJDaiLTx7Pm1kFcTjfztO32cSoBba6pIJ4pdR6XoNqKkDdnFk5-9KGYSymyXaA2R-PUbsaay98KVobR23-QUq7Ch/s1600-h/image%25255B89%25255D.png&quot;&gt;&lt;img style=&quot;border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px&quot; title=&quot;image&quot; border=&quot;0&quot; alt=&quot;image&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg8uOp5aXW7r3juOwKLP3zXTsRPXPoWW0lgObc7fl9w4Z94SKtK9678v4Y04Z37mJKLq3IVo0hT_7JUB5WIvLxbtBUM2bGoB1jAVbhnatUTQ3Mgrjfl-HrhMmz0J13M-F-PfhdTp6LEKzXo/?imgmax=800&quot; width=&quot;412&quot; height=&quot;115&quot;&gt;&lt;/a&gt; &lt;/p&gt;&lt;p&gt;a++就是a+1&lt;/p&gt;&lt;p&gt;还有也可以--&lt;/p&gt;&lt;p&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiy8vC8JxJMfV-80cX2OJqzPJeeW4RsL0sN17HmLMh7SrYHb8H358s6gfM0uLDQQy4gUy09eGfdZhOICNBfCCG29n-xljkqI6Em9SXzniaLyL6nnrEUPr0hOUKqVmzXFOPs_21hwdbNFCtm/s1600-h/image%25255B92%25255D.png&quot;&gt;&lt;img style=&quot;border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px&quot; title=&quot;image&quot; border=&quot;0&quot; alt=&quot;image&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiTvvDsCz2uRCBK0DxVVFVKN5-HGvAPu4bC31W4zyyM_pYkbOzVof0QhHUwEiMY81WltjsFINWW9pk7k74yx-bygOI5FJZEfdfqL2SbahutwRY2sqdpo-J8QaYg_wuzapT_ohdUBKzfkkuw/?imgmax=800&quot; width=&quot;407&quot; height=&quot;151&quot;&gt;&lt;/a&gt; &lt;/p&gt;&lt;p&gt;就是a-1&lt;/p&gt;&lt;p&gt;也可以放在前面&lt;/p&gt;&lt;p&gt;++a&lt;/p&gt;&lt;p&gt;和&lt;/p&gt;&lt;p&gt;--a&lt;/p&gt;&lt;p&gt;结果：&lt;/p&gt;&lt;p&gt;4+1&lt;/p&gt;&lt;p&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh7AfbigpvAi_xL6nIaq1YaPon9ksNJcIOI_vehXTPJalnTHhs49cc7N1wG84bWpXJtbHWpDA0HuikoSJB3kULa9pCEvAty1dxwinxcJiT0z3RuL8r6JLmEYAkFbskfuOWbGeoKIA5ItqDF/s1600-h/image%25255B95%25255D.png&quot;&gt;&lt;img style=&quot;border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px&quot; title=&quot;image&quot; border=&quot;0&quot; alt=&quot;image&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi50UosWqW3rti0GDQykRdgsv8KctGyVNA5Se04Cw4XlQtYCcEQROuTuvyFV-apSr3tviTTrxHcV-hrvHwPuWtCObnJ2X05rP8zMbYJtdVYrxyi3m8oXXAeS8iNqeSs9uXanU5-qzeVgZfn/?imgmax=800&quot; width=&quot;304&quot; height=&quot;305&quot;&gt;&lt;/a&gt; &lt;/p&gt;&lt;p&gt;5-1&lt;/p&gt;&lt;p&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiYfRFOl-qLGGIaoIm67qyl_s2C-r4n8q697g7nolHwS9o4y87faaJF7jcDrwssE9RTr1V7IdqwCU2PSqa-QZUx0LmlrpSyEOD3WEA64sFOPlSwkR9uHCJoe8gFBtFha0iBn10XPQhr8qXA/s1600-h/image%25255B98%25255D.png&quot;&gt;&lt;img style=&quot;border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px&quot; title=&quot;image&quot; border=&quot;0&quot; alt=&quot;image&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjJk3R2-waz3yGkvaPukT_9npJzuyBOCbwGr43A_02F11GRaqZmyRNTochJ0DrbK5Lz_BL-Vhp1EcGXtNv5PQeXciGHnb6F9DlFF0JWdQvbgCSiQjrYkUzAPW25UeTF6rcKqOja86FV7UWG/?imgmax=800&quot; width=&quot;304&quot; height=&quot;305&quot;&gt;&lt;/a&gt; &lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;但是++或--放在前面和后面有分别！&lt;/p&gt;&lt;p&gt;我们来看看这样的代码：&lt;/p&gt;&lt;p&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh-M-u7EsSBl3AxX3uZVRr55-m1O_zCwlihn5YmQZUrLuAxWlKiWyUtVbbYuziWJeQWYFHy_KTSlgTNobLHliK4W0YPwkqPIkUGLzxiPjNX20o4oM3LdkSk4dHi20AOED47Ds_mvKkqHdj6/s1600-h/image%25255B122%25255D.png&quot;&gt;&lt;img style=&quot;border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px&quot; title=&quot;image&quot; border=&quot;0&quot; alt=&quot;image&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgDciSlFzTB_pC-Znj728mwr7TJpZYVBDVpxu9sCrgrfK_Sd1RtTnZWW4_D1qj6dCEQARw_cjFGaLtYm2Mot1qbr_uJFMA8PRoj5y9xs52P6aBTazN2GwqMUX6JjTNXT6ZmFF4mmlUJLDt5/?imgmax=800&quot; width=&quot;401&quot; height=&quot;124&quot;&gt;&lt;/a&gt; &lt;/p&gt;&lt;p&gt;运行的话：&lt;/p&gt;&lt;p&gt;你会发现v还是4&lt;/p&gt;&lt;p&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh7hDZGF8XW8ZaG1TsTpI7az5TxPThfPKmRHnXWaYg56bI7G6ugx3CogA5dTAfzGoroiUdhSaZ3gTzDMhHIdGh5LH7dLMV83tZlHHwHFYE7XAKZbAOEIfKLEopqGChFXU9ICAQv469bwlN-/s1600-h/image%25255B128%25255D.png&quot;&gt;&lt;img style=&quot;border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px&quot; title=&quot;image&quot; border=&quot;0&quot; alt=&quot;image&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiMym423_svd_1fxnW_ecY4bBWqohlE0tVm4vXlYK3siL6NMeC65SabvJW8d8G99PQpXe7AhOqnZrYJ27vEixZRWze7XWfToMelobCvwJvV7mpCXxZURTh7YVpXpR8iCc9K2BtnBy7Z0ryJ/?imgmax=800&quot; width=&quot;313&quot; height=&quot;308&quot;&gt;&lt;/a&gt; &lt;/p&gt;&lt;p&gt;a却是5&lt;/p&gt;&lt;p&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhGkugDS3MHEqMKvKpMCXv3YXCQGTS9K42r2Uljkx9bxM5GTOcaaF2CnO9qkk_mgQ-KWGUfg_p2ZSHV1swomkklWrIuuZ89ksTGGmg5w7j8zbRmVvbm6h5SOYjEeXFyTNt3gODAEeDfbtEb/s1600-h/image%25255B131%25255D.png&quot;&gt;&lt;img style=&quot;border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px&quot; title=&quot;image&quot; border=&quot;0&quot; alt=&quot;image&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjUqDY7CSHrCjsvegao6NgO8SIgIqh9tx9iIpcrISoiBvrSZb7nKLOUVxG9COHnxhm1Fo6LGFbYd6ZTgzcTN5p15Z2FEdceycUfYuakIDf00HbONqZEMWQGRaodCzKou0Zqi_hJaMD-Rfo4/?imgmax=800&quot; width=&quot;313&quot; height=&quot;308&quot;&gt;&lt;/a&gt; &lt;/p&gt;&lt;p&gt;为什么？&lt;/p&gt;&lt;p&gt;因为++在后面是post increment&lt;/p&gt;&lt;p&gt;就是说&lt;/p&gt;&lt;p&gt;int v = a++ 中&lt;/p&gt;&lt;p&gt;它会先让v 等于 a&lt;/p&gt;&lt;p&gt;然后才让a = a+1&lt;/p&gt;&lt;p&gt;如果把++放在前面就不同了：&lt;/p&gt;&lt;p&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgp3YljLS7qV1TH_1I6wnf3HwUCPjgYNGuW3C5Qjcruo1sDzzuqoPJP7COwJLLWJaI06urUoZlgx9jUztoWn_ya93UAs5XC6AaXo-9C0scc8TCnNcAa8uaA3Guywvom7YhpyMZ-QrHBRrRX/s1600-h/image%25255B134%25255D.png&quot;&gt;&lt;img style=&quot;border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px&quot; title=&quot;image&quot; border=&quot;0&quot; alt=&quot;image&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjBcI7Hc3NEyTXALWhZGRAaa24l9vjvT_D7AZzoEx0tplfB_YSRj2ABKaWiEh_0-BeE1SfvK_DU8zKmgDcyvMOT-Y2qvvylIiVc3mKKQ4DolZS7JjKMn6nuQ7QU7M5gswQhi7QnOYKV-t6Q/?imgmax=800&quot; width=&quot;411&quot; height=&quot;119&quot;&gt;&lt;/a&gt; &lt;/p&gt;&lt;p&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhJx4yWU2IFsQ4a3CIYmdFCzMaIhoVSNbXsTggNGy-hMVI01f2xTHmr7VTQvYXuW_zbXz2ErggSy8gizYS12cumWU4AfCrymVTYy3UTjrX3B2OjZYUQtIhEuU0jbTnDnmXzItW1B4H5Fxqj/s1600-h/image%25255B137%25255D.png&quot;&gt;&lt;img style=&quot;border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px&quot; title=&quot;image&quot; border=&quot;0&quot; alt=&quot;image&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjdId7uCKonmWwzDebXOJhiDcFL5aB1R1Q_RUPqt6N1S4SzVFttLR2zJTMYGHEqiutU3BDXRc30yN0795tzKot6-Ea8rXB3_EltZ7rZCa2N5-BomJqct02bbYRq6lUbgjvzwvpNQd1P__3k/?imgmax=800&quot; width=&quot;301&quot; height=&quot;303&quot;&gt;&lt;/a&gt; &lt;/p&gt;&lt;p&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgS4MdNYQh4Rhdg25FXL4QN-95oeLTDBHUeMOuYNZlP6E_1C0He5o8Wz1jMn8wUMYeLZsRhmnb4S4He0XWu1vWB0gufpy5pEZdXgu5TZdmVmECNkFs231Ckt507JRMl8EZgjs1gWSRWR8P3/s1600-h/image%25255B140%25255D.png&quot;&gt;&lt;img style=&quot;border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px&quot; title=&quot;image&quot; border=&quot;0&quot; alt=&quot;image&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiIAzoQNCPBcFVKDVn_dant2Y19uhFK2lPLwxbRmQofx7MBBvLGClhePdHn7IR0nwkHM_bkPdJ-7fPNw9LORQiF_kqs9HqXOdbImSMiLnUStJ71NdmEGbczh9dXdq-iOu803TsltV3IMu0O/?imgmax=800&quot; width=&quot;301&quot; height=&quot;303&quot;&gt;&lt;/a&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;a 和 v 的值都是一样的&lt;/p&gt;&lt;p&gt;因为在 int v = ++a中&lt;/p&gt;&lt;p&gt;它先往a + 1&lt;/p&gt;&lt;p&gt;然后赋值给v&lt;/p&gt;&lt;div class=&quot;blogger-post-footer&quot;&gt;&lt;script&gt;
SyntaxHighlighter.highlight();
var linkwithin_site_id = 1130633;
$(&#39;#toTop&#39;).remove();
$(&#39;body&#39;).append(&#39;&lt;div id=&quot;toTop&quot; onclick=&quot;$(\&#39;html,body\&#39;).stop().animate({\&#39;scrollTop\&#39;: 0})&quot;&gt;Top&lt;/div&gt;&#39;);
$(window).on(&#39;scroll&#39;,function(){
if ($(this).scrollTop())
{
$(&#39;#toTop&#39;).fadeIn(&#39;fast&#39;);
}
else
{
$(&#39;#toTop&#39;).fadeOut(&#39;fast&#39;);
}
});
&lt;/script&gt;
&lt;script src=&quot;http://www.linkwithin.com/widget.js&quot;&gt;&lt;/script&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://garyngzhongbo.blogspot.com/feeds/8902018003450098921/comments/default' title='博文评论'/><link rel='replies' type='text/html' href='http://garyngzhongbo.blogspot.com/2013/11/c-10.html#comment-form' title='0 条评论'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5319618319979683940/posts/default/8902018003450098921'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5319618319979683940/posts/default/8902018003450098921'/><link rel='alternate' type='text/html' href='http://garyngzhongbo.blogspot.com/2013/11/c-10.html' title='[教程][C#] 新手入门教程#10——数学运算符'/><author><name>Gary Ng</name><uri>http://www.blogger.com/profile/00014057672539539340</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh1moVFtd4LLXZuHBWciMM8UgceJBy-u0E2MUwGAizmUOZB91t7HYqYiyU01OhUiDVtN3-fI4fdM_HnGrpZ4ixhAhUDS7PDHGwrPzNU4Wn1IS2A438yBr67WZTuWciEqun7grcGRWhez9GR/s72-c?imgmax=800" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5319618319979683940.post-1943722566345793188</id><published>2013-11-23T12:42:00.000+08:00</published><updated>2013-11-23T12:42:40.329+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="C#"/><category scheme="http://www.blogger.com/atom/ns#" term="入门"/><category scheme="http://www.blogger.com/atom/ns#" term="原创"/><category scheme="http://www.blogger.com/atom/ns#" term="教程"/><category scheme="http://www.blogger.com/atom/ns#" term="新手"/><title type='text'>[教程][C#] 新手入门教程#9——switch</title><content type='html'>之前介绍了if..else if .. else 结构&lt;br /&gt;
你；switch 又干嘛的？&lt;br /&gt;
我：恩..很简单，就像if .. else 的结构代替品，在特定的情况下，你可以打更少的代码！&lt;br /&gt;
你：例子例子！&lt;br /&gt;
现在在你的Form上加入一个TextBox 和一个 Button&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgeLrhLZaVLHRHIyf1KYdBOZZgDo4bB0MLfiwI5Udx-Vb1LY25-pXGtehyE8oaY-iT6qc233SrmG0se2Dp56EkiSV_uaYQd9lJNS3KbiLlx2lWr_PjKZS6BaYtE2VsWD9-fSCGFcP9mTcb2/s1600-h/image%25255B2%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEigLN2f9zQHUslj4HWVF5XygxuHV_hnyhaR7K-VqI-FtGYSC8SrcJzdr33I3ZuJ_2D0dfsHu5mR_oOOAvcHlT3cU9EQmctw6qD0co8vGqoPmI5vCx9H0yTimqSPKTD-pcXSAYy8DbuG2PjV/?imgmax=800&quot; height=&quot;355&quot; style=&quot;border-bottom: 0px; border-left: 0px; border-right: 0px; border-top: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;346&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
双击button1（还记得event handler 么？）&lt;br /&gt;
现在你需要检测textbox1 的 text&lt;br /&gt;
&lt;blockquote&gt;
1、如果是Hi，messagebox就显示Hello!&lt;br /&gt;
2、如果是Bye，messagebox 显示Bye!&lt;/blockquote&gt;
（很像之前的if..else之中的sample吧？）&lt;br /&gt;
如果用之前的if..else 写的话：&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjd_-OsoygSSIQ878-ZRgypygmEXDJHBALyaTo8vXKjq2ZVrcrx8ZbiIhol8FxQFKl_U27VmX5AZeNQzG6DTT4UwauiGf52ADo-AItppDeY8ZIOLvtAKFrkO1meO5qqu2EpbbWC0umW06cX/s1600-h/image%25255B5%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhm_YxkVn8G8CDBPaZrtcH1tlXOMneB6A6dYXTkW6hR5foIv8MuNyw_PMgg6EpEUmf40U1gJrTWccxV-vnWd_M1z0-DFI9tOkBALWkz1yWR-8bvjlmOMQMpGLXUYjpzRv59wfEBfZyB8NVX/?imgmax=800&quot; height=&quot;194&quot; style=&quot;border-bottom: 0px; border-left: 0px; border-right: 0px; border-top: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;433&quot; /&gt;&lt;/a&gt; &lt;br /&gt;
写很多个&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjqBK0NAtCMcJBrPEI1h5fbPEzUhpYhwSwT-CU4-9nHkPk-qu5qNMyyThVBff5aCPgxEG_gpfxWTwVdt88WsRsJDwtoMA-1OCUfDCAXFoPqNg9V-K5UTy-b3q8vJVhwDYHrlh8VvsgXIgwC/s1600-h/image%25255B8%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhVB2u3j414hLvkbIpl2UsvKjahGSrIICoBrP1W5Yi57q3PEaPO_75PuUAtiupCtw7MTp2Qjr5pXmChQppVgj_AFDtrGi5lBdJxBjbGEqZKXdOfKyfBIgJeyBY23As2cGpXTZFU81O4wMsm/?imgmax=800&quot; height=&quot;30&quot; style=&quot;border-bottom: 0px; border-left: 0px; border-right: 0px; border-top: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;148&quot; /&gt;&lt;/a&gt; 是不是很不爽？&lt;br /&gt;
现在看看switch 怎么写：&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh6vlaxeFTOFZEYxI-TMUiDNBvyGnwT_y_ExdYx7gdiF-0e6x3zOVLE8ApxZ_73cheMpgrsYAkpKOAWhMXQbcRCFV-0UoRL6gVSRxZGoVvesEgU-BdKhcltqFJvAfVGcwnDNqPx0pbBKRNa/s1600-h/image%25255B11%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi64VTYWWlbbiFME-9sc8oQUXkcctsID42mfEBq4Zfz5x-5Igz4RtVVBdF8oAMW1Rs_Ky-_e_mHmOYWj28VkjM5H5i-KK5NpL7ikuDq52e2_2IMcB7ySQxjRrDFQ_b3DgVqv9fUEFzqwTTK/?imgmax=800&quot; height=&quot;85&quot; style=&quot;border-bottom: 0px; border-left: 0px; border-right: 0px; border-top: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;179&quot; /&gt;&lt;/a&gt; &lt;br /&gt;
switch ()括弧中间就是你要检测的东西&lt;br /&gt;
这里就是 textbox1的text&lt;br /&gt;
然后{}里面呢，就是各种不同的情况（case）&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgId6GxJpPTggEzJHE6w9vUSH4tqKpEHWRlbVeIj4c7jqGTu9xzcRsW9qEJRndOZ2ISIa7CYXqlk63MASyCFy_y7pmvBZqW7_l0wZWjcs-teqzZtYoLu9e6UFW-yeKcK5aM0qbS654SoomO/s1600-h/image%25255B14%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjGOHeEY4oIGN0KUDJD8YUxi7cwChTn7Q07eqhKt2ohcEyyI6BUMLBtGr6mnQGSqcDNOwA5yVeQ-oFWQ2euThBxU20KNOY9RpssThzLsLkvgVI7KYq1mv79GFiIvZ443IGqv4wxaUiVMiFb/?imgmax=800&quot; height=&quot;148&quot; style=&quot;border-bottom: 0px; border-left: 0px; border-right: 0px; border-top: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;424&quot; /&gt;&lt;/a&gt; &lt;br /&gt;
case 跟着需要的情况，然后在加上一个冒号&lt;br /&gt;
而下一行就是需要运行的代码&lt;br /&gt;
这里就是messagebox显示Hello!&lt;br /&gt;
但是不要忘了break&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjlvi-n5O8ibCQFQwgOLOiSEnkd2YfN_EmS7NO7SZJ8WB-ZSWTELrMHCW0RHw4tweStmVmvX73Yrr4Kp_BofqoFKygV0JwvFFxyzn3eNRjIMNWHPOfaq5SIG3gr7C-l7FUR-Pd86V8XyQQT/s1600-h/image%25255B17%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgBP1pwYRobx0IYYcVnhmw7WvG7cLWjtjCouNnwet4gdzSjm4YZm8XMgDla_Ei_S9FAqn1UIbb-7WT9EvvemPNuutx0Niru8EqOKMg-EC2eB8mtqusMnjNbqXY45ng5oBeAv4cUURg007cd/?imgmax=800&quot; height=&quot;148&quot; style=&quot;border-bottom: 0px; border-left: 0px; border-right: 0px; border-top: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;424&quot; /&gt;&lt;/a&gt; &lt;br /&gt;
break 就是&lt;br /&gt;
&lt;blockquote&gt;
检测完这一个case后，直接跳出switch，不要在做任何检测&lt;/blockquote&gt;
要清楚的解释这个&lt;br /&gt;
我们加入几个messagebox&lt;br /&gt;
然后运行试试看&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiSckPGSb1fhZBMKu5U8YdlM5cH6zQ_bXSleUagt6HwgDwTbqGdKxaOgOoUhCySst8PcnsOrP51ZDWRprjFzeniuQgjd4cm1a85GLueefG3XbsPMdbn_V5b9EyqP31_O7foQKGsSO_lf1Zk/s1600-h/image%25255B20%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiQwlKHnBaFhqiXj8ISwvQqRqH-Ft3Hb5_j6bQ6R6pSWkes4YVAFyaGhIGoA9Pk7D0fBVPiNRWv9jf0OraQs7uwa-xmQEWGy-XoLvp7L1UOX8oCQFdZkl3mY8Afs5Mlf4ECH8y0o4laHTs_/?imgmax=800&quot; height=&quot;204&quot; style=&quot;border-bottom: 0px; border-left: 0px; border-right: 0px; border-top: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;408&quot; /&gt;&lt;/a&gt; &lt;br /&gt;
首先输入Hi&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhWwAg6gGCcX0-Fca5QphnVoAQeiLlGApZ4TGMNeNTWCc1ZJ9npeDPqeoGJ_oMI_xyrpYJLVNQFd6BA_YekDTeqJgwPzj1aOz2FpOuMKrfk72v8-2t6t7fW11JLEHz_05b3bXx4qQOavy_P/s1600-h/image%25255B23%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjwmBBj5JyaNbmo8k2mZmJ3uHsISC53-zxPY17q5TWduGKd7QHI4GMN93OUjGPP_1x9yPqadLAHnzedihskLqxqLm26nPh3YNAgC1Q7KTE6-Hc5UIL_nIHTxKHR8TgJzTKk1R4A04U3Ee0x/?imgmax=800&quot; height=&quot;300&quot; style=&quot;border-bottom: 0px; border-left: 0px; border-right: 0px; border-top: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;300&quot; /&gt;&lt;/a&gt; &lt;br /&gt;
点击Button后就会看到我们的messagebox Hello跳出来&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjaPuLVRTSGiASy-8cH5IAgtwGg7Xliw6AMPyweKz1_DnDMg2PenKMrh_-O6VnSq_XBFXn0yk9EszCgVtKDXYzPlgMtvBBKONpLZsYb0ZsMbIVSkKm-gQYp6Q_XCKVjNm4uGSgJJ1VoGNDf/s1600-h/image%25255B26%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiMInz-3cU0O2HEjFX73ccB4EvVqybMpesAv-XvDzHRGZHAJzyBf5dleMYlXKYbrpTAxAA2RaTnCflCZcm1kc6Lc-v577QY-woir-pigUTbDU9eIR6WSeVwDK0jOZq_b_gQstlwS04nKSjd/?imgmax=800&quot; height=&quot;300&quot; style=&quot;border-bottom: 0px; border-left: 0px; border-right: 0px; border-top: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;300&quot; /&gt;&lt;/a&gt; &lt;br /&gt;
点击Ok之后，你猜猜会出现什么？&lt;br /&gt;
After Switch!&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEghAbZWCu135W4rM3__icISRD6RpBvpREC1kCxFo_5_GOHDRuVVGXs-UcC5BLuuEM8i05nbjly0MZFJHP8SSNvJ8Sd5L0C0UU1k3FLVEzG5RcWW7oAoocw2h_GY4wDJRJbirX9pOP1mb39t/s1600-h/image%25255B29%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg5Is2vRpp_DVyGZUMrObiPtJ2k0x_tjlhfyD8JHGR17NbPWP7yL_AZOJON-7KV1xa-1X-RbaE21FKmhWZV5wepn2NshnZhYe4YeQVKJRmKyO4eHV1v690RdlqaSZEt-JphXi7wmlQpTgcj/?imgmax=800&quot; height=&quot;300&quot; style=&quot;border-bottom: 0px; border-left: 0px; border-right: 0px; border-top: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;300&quot; /&gt;&lt;/a&gt; &lt;br /&gt;
清楚break的功用了吧？&lt;br /&gt;
你：我们的Bye情况呢？&lt;br /&gt;
一样！&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEibvFvRN4WVfn_r57E4Z6CGK4beN6Fo-f-YGFhcqI5CP_0MclJ6GWkNqpN8bzqdMCadRkaLrYwWFDfjtU4WuxlC73Mad_mFpMaHsbh0my4xTy4Ts4X_4Bm7Ix9tFoRP1xWf7qrFbA2MGSI3/s1600-h/image%25255B32%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh6upMKoJJzorHreMGhXY30pnkcMpiS2e4qfd2UE_BaK-GvvKWG7aB7hH0KjCHy-6pmg4CeWpVbkdoyqTFH_8LW8dVaBrV1JEmxXMYEM7VvpDTdVZCsotWPibbWJRs6187oIxgwm-PFyJue/?imgmax=800&quot; height=&quot;200&quot; style=&quot;border-bottom: 0px; border-left: 0px; border-right: 0px; border-top: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;410&quot; /&gt;&lt;/a&gt; &lt;br /&gt;
现在我们来试试看&lt;br /&gt;
输入Hi，显示Hello&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiUneY2UsXx7-ntdxmCApiQTnxcfgaUuu-108tL8ExU7pfKAK7U4tLieLUPTht31UWprR4vYssMdvAbt81IUkRqdIX6_Pf-1OuzxJ01RihYr6kU6s_DGBgjqi13cQaDbNT7MOZiK9x0HMBD/s1600-h/image%25255B35%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgU73zoQb6pl2tBymT613UvnFw6tHUzDiVqf6mKkoAfMpIwT5InjlbSpqODK8IKvpIrlnFUqu5WV4P2D0Gb3OrQhoRMXDQ4Etsxuz9Qhi8RDEwpFwaWRUnCLUzQkzQgV7b75bMs6SAWpKin/?imgmax=800&quot; height=&quot;300&quot; style=&quot;border-bottom: 0px; border-left: 0px; border-right: 0px; border-top: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;300&quot; /&gt;&lt;/a&gt; &lt;br /&gt;
输入Bye，显示Goodbye&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiL_F1yeK-7jHUJbOtZlaDJdSfSI3EYBUiSTSveKyD4NiImglmkC4MfIrTZfXFt0zTRt1IdYkjPW1b4PcJi8bGhyisVG6yBSCglZY903I68Dm9Am33Jdfljv3dHF3bTwdwIlP9rYdEIG5mk/s1600-h/image%25255B38%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi32OLipJzduaiJ0EcNqNwjmrac7KX3T7aYaFVEV5T8e_CdVBC-ieo7OKaUxGB0vZB18V09loGFdEzM5ZG5WRvIxxBbVIacbZYEx9Fb_TT83c7yfz1eNSGV8vEucxoKc4L-EpI_8aKM8vFK/?imgmax=800&quot; height=&quot;300&quot; style=&quot;border-bottom: 0px; border-left: 0px; border-right: 0px; border-top: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;300&quot; /&gt;&lt;/a&gt; &lt;br /&gt;
但是你乱输入的话&lt;br /&gt;
却什么都没有显示&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiY0tftwEcHH-B_1ShvP8VUogPZ5dKxK8xWlJUAUSunAoiRoBnr-ZiuKrTOn_DKTx7PLcetC-mZRvlWNK0LPTwPtMauZ33tIytwP6P8gp5CyaJBHbQyK7oh9nrED7FtxThTSJBgVwDjI9q2/s1600-h/image%25255B41%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhep8M5cCOkFze7nAIQUu4L2ASCmI8xMPYpyHRmnFXya3VPPyYoT1QTSV9OB42B0A-zjFqz3w44vOE6ZvPv5sXmSdEYHIecIFRx0AP85yR0G7FH0m5GbGOH_g-fvFQ35nuLS1ns4qeQIdTg/?imgmax=800&quot; height=&quot;300&quot; style=&quot;border-bottom: 0px; border-left: 0px; border-right: 0px; border-top: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;300&quot; /&gt;&lt;/a&gt; &lt;br /&gt;
你：为什么？&lt;br /&gt;
因为我们的switch没有这个case！&lt;br /&gt;
你：可是 if .. else 会handle 这种情况啊..&lt;br /&gt;
当然！switch 也能&lt;br /&gt;
如果所有的 case 都不符合的话&lt;br /&gt;
switch 会直接运行default内的代码：&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEigKuK10WM5VcxT9Eu2FEvBlyde3H_2uMKU0kGub04fg0o2KQwTWJ2Zi5o5o2abOns0SMnotn6tn9gLKU2Wij6Rt4oHxfOcUP135wfPA1daKjKj7nij5vZ2RfTCOmzNcMmtJIw6FJGcBONE/s1600-h/image%25255B44%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjUGViKemlp3hRLgWxt1OCnbOjXLgP0IPntGigCGYftNomUYElCcEdc-EcOmqRr0N4EbspC-V7zT0r8NV-lXnWRa6qC5laGd6V_Cx-VvLgku7ddvmP-580zoO_J3snoJyg6mFJLKHmRx5N6/?imgmax=800&quot; height=&quot;249&quot; style=&quot;border-bottom: 0px; border-left: 0px; border-right: 0px; border-top: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;412&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
不符合所有的case 的话&lt;br /&gt;
就会直接执行messagebox 显示 blablabla&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgUQnIH9L9LlwuaYPgN8pU35CGpRcAIqbNMxwUv1jGfupr-xVNdimgAJMChKA0dCHS4k6QIn-c1xp8P8HoxieJhKYF5ml2weDrGGl_0UUoWWFqEhdJOJkTWMp-0iySv8wbz7PRKf29ZPdfU/s1600-h/image%25255B50%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgtAAlwCon-vtLSTlPXjVbRMTT-iJNW45GPfF8Ay8-XXfEhT1IRQDOdDG4jnTkUcwoMsQBiScGx3Wisl1VcgHV-AyB29mJhfCeBR7jO_iJdMM5K7vfjVnN_2hK08Svmym6BAEVrNO4TKq3d/?imgmax=800&quot; height=&quot;300&quot; style=&quot;border-bottom: 0px; border-left: 0px; border-right: 0px; border-top: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;300&quot; /&gt;&lt;/a&gt; &lt;br /&gt;
&lt;br /&gt;
当然&lt;br /&gt;
switch 不一定要string&lt;br /&gt;
什么类型都可以的！&lt;br /&gt;
比如：&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiCzvvxsJWhRPWqmEOEqqR4DRt2yenCUKB-Y4_rrTyOA2mrhCZCi-QvU-XJMDIlJ57zvb8BilNgsfA1aUcpuAl0isLALD8KODFfNoxADIspvTFuqMcOAQg4ffoopDTbEThV6304D4dWWEJU/s1600-h/image%25255B53%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgMFL6febQ5RfIf96s7unNRn5ut8zR50-m0PM6NVZBrYzc8l_LGI-oyJmK5-X6-Jv-X7uuhffmFkOtY6tE3Am6ZNUwHWbI9OUIhgPb2HXzDVu9wTQWZRC4Jqs99l4oJad1EOBWUxjJLA5gv/?imgmax=800&quot; height=&quot;329&quot; style=&quot;border-bottom: 0px; border-left: 0px; border-right: 0px; border-top: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;428&quot; /&gt;&lt;/a&gt;&lt;div class=&quot;blogger-post-footer&quot;&gt;&lt;script&gt;
SyntaxHighlighter.highlight();
var linkwithin_site_id = 1130633;
$(&#39;#toTop&#39;).remove();
$(&#39;body&#39;).append(&#39;&lt;div id=&quot;toTop&quot; onclick=&quot;$(\&#39;html,body\&#39;).stop().animate({\&#39;scrollTop\&#39;: 0})&quot;&gt;Top&lt;/div&gt;&#39;);
$(window).on(&#39;scroll&#39;,function(){
if ($(this).scrollTop())
{
$(&#39;#toTop&#39;).fadeIn(&#39;fast&#39;);
}
else
{
$(&#39;#toTop&#39;).fadeOut(&#39;fast&#39;);
}
});
&lt;/script&gt;
&lt;script src=&quot;http://www.linkwithin.com/widget.js&quot;&gt;&lt;/script&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://garyngzhongbo.blogspot.com/feeds/1943722566345793188/comments/default' title='博文评论'/><link rel='replies' type='text/html' href='http://garyngzhongbo.blogspot.com/2013/11/c-9switch.html#comment-form' title='0 条评论'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5319618319979683940/posts/default/1943722566345793188'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5319618319979683940/posts/default/1943722566345793188'/><link rel='alternate' type='text/html' href='http://garyngzhongbo.blogspot.com/2013/11/c-9switch.html' title='[教程][C#] 新手入门教程#9——switch'/><author><name>Gary Ng</name><uri>http://www.blogger.com/profile/00014057672539539340</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEigLN2f9zQHUslj4HWVF5XygxuHV_hnyhaR7K-VqI-FtGYSC8SrcJzdr33I3ZuJ_2D0dfsHu5mR_oOOAvcHlT3cU9EQmctw6qD0co8vGqoPmI5vCx9H0yTimqSPKTD-pcXSAYy8DbuG2PjV/s72-c?imgmax=800" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5319618319979683940.post-2887398668369177064</id><published>2013-11-22T13:47:00.000+08:00</published><updated>2013-11-22T13:47:31.982+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="C#"/><category scheme="http://www.blogger.com/atom/ns#" term="入门"/><category scheme="http://www.blogger.com/atom/ns#" term="原创"/><category scheme="http://www.blogger.com/atom/ns#" term="教程"/><category scheme="http://www.blogger.com/atom/ns#" term="新手"/><title type='text'>[教程][C#] 新手入门教程#8——if..else if..else</title><content type='html'>&lt;h1 align=&quot;center&quot;&gt;
【if..else】&lt;/h1&gt;
之前我们用了两个if来检查MessageBox.Show 返回的值&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiYt3293CFl-ElHKeNjYRexj7s4iwsmD4mUSzk9XZbULtNSXI-U-iGpVbwAxLdHoBndYNTx-jIJ0p-SnfKuX4WJnhnGuahMiFax9Vn3W9-YmCX2QkmJnvuiIP3T98dosEsGBeKYZML4Few/s1600-h/image%25255B2%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjsMIhfx-Km5D79jBvV9hADWCLrksc-rYNAT6Vrehs575DMj7shNmTjX2w_1K8wTM18Wi1km7505SQIxLzTa1aBG5LR6FvcHOUtZVbBSwkB5MnIvk6F8GbaWlBo80Uav4N6RnY1ZnqvTt8/?imgmax=800&quot; height=&quot;224&quot; style=&quot;border-bottom: 0px; border-left: 0px; border-right: 0px; border-top: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;605&quot; /&gt;&lt;/a&gt; &lt;br /&gt;
&lt;br /&gt;
你：有木有不打两个if 的方法？&lt;br /&gt;
我：没有..&lt;br /&gt;
你：一巴掌（啪&lt;br /&gt;
但是你可以用if .. else .. 来判断（你还是需要用到两个if，但是整个代码的结构会比较清晰）&lt;br /&gt;
之前的代码的运作流程是：&lt;br /&gt;
&lt;blockquote&gt;
1、先检测msg是否为Yes，如果是，运行代码&lt;br /&gt;
&lt;br /&gt;
2、不管之前的检测是不是Yes，检测msg是不是No，如果是，运行代码&lt;/blockquote&gt;
有没有发现到，两个if，代表msg &lt;strong&gt;始终&lt;/strong&gt; 被检查了2次&lt;br /&gt;
但是如果msg 等于Yes的话，就代表他不会等于No，那我们只需要检查一次就够了&lt;br /&gt;
所以if .. else &lt;br /&gt;
在这儿就很好用了！&lt;br /&gt;
改进版的代码：&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjL7tli9fy-tDsAgx083OvcUomsK331x5sT4KZgdLcMwBPvG5uYXQi-rrPIzuOt5UpjTkL2I_fMgXWb8iJ75Fiu0XQAUOct05Bgpk20y79fpfMySS5_eBPFr5GK9cDKD-4A-6pGGDv-1vE/s1600-h/image%25255B5%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjwCtbXksjFYC1O-2NrvV8_OxS2I96zKbd6F64aP2_EZjNzQJv-ff91qZEEHhbwOT3iV39s0BQQWgROsa1UnTyyDVxU6qGs3LkErYabKaOL-6IVCRlGekigk7gMAzAQwRp32BP4RNhsYEg/?imgmax=800&quot; height=&quot;224&quot; style=&quot;border-bottom: 0px; border-left: 0px; border-right: 0px; border-top: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;605&quot; /&gt;&lt;/a&gt; &lt;br /&gt;
&lt;br /&gt;
现在的代码流程就变成了&lt;br /&gt;
&lt;blockquote&gt;
1、如果msg等于Yes，Messagebox显示Yes，然后整个if 结构运行完毕&lt;br /&gt;
&lt;br /&gt;
2、如果msg &lt;strong&gt;不等于&lt;/strong&gt;Yes ， MessageBox 显示No, 整个if 结构运行完毕&lt;/blockquote&gt;
现在最少只需要检测1次就行了！&lt;br /&gt;
&lt;br /&gt;
&lt;h1 align=&quot;center&quot;&gt;
【if .. else if .. else】&lt;/h1&gt;
&lt;br /&gt;
在form 上加上一个textbox&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgZFkCrCWgnUKDgZw1s8fowD9ndRSikWlWemZae3A1vq7KCW8d2F1tFlB1nmYmcUJZIOUWMXHIgHnXF82mJsGEUfvf86R1LjleNKU6_AVRARy0cJpnFBjZgChBKKXB-AiY7ZMh1qqb_yZQ/s1600-h/image%25255B8%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhjSoswa5XMf2dxOgvr9xMUQfp8vIMA3jfMZRznnSsP6PeeOEVqa9q2GjMZhQ1RtKIWeCd8ARyIZVjaUwkZKh9Ez2ihF8llCY8yrBwz00IIEhPP4-E5dKjixEpAdfIAvB_blzjrXraLepc/?imgmax=800&quot; height=&quot;389&quot; style=&quot;border-bottom: 0px; border-left: 0px; border-right: 0px; border-top: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;398&quot; /&gt;&lt;/a&gt; &lt;br /&gt;
然后在button 的 click event handler 之中清除之前的代码&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjetVfw4YzaY0bNFxDtlhsW9kpI_zCz21hSfbC44GpgCMXhfuTKXxMJZ457bc0nW1T-8wderWTldzROzyQC-GbK5BZ_lxehG0jaVhTYnjJ4_Ft60fpz3WYq5lW1m_zk-pHko2Nl2Jay5m4/s1600-h/image%25255B11%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh3aMlAi63R_t8oKEU0PgPqJ5BQ9_cRsaAgg257kNd9Paa2ItwcnoaA-MZ6fQKtfSH8O3HFAkDMoBYBF0-jsPDmKAAp_YmN0flOJZ7HWGrekND8vFuZaem8ctbCkcJe8NXLnGlmp3gk7Vg/?imgmax=800&quot; height=&quot;437&quot; style=&quot;border-bottom: 0px; border-left: 0px; border-right: 0px; border-top: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;632&quot; /&gt;&lt;/a&gt; &lt;br /&gt;
&lt;br /&gt;
现在我们要的是：&lt;br /&gt;
&lt;blockquote&gt;
1、检测textbox1之中的text是不是等于Hello，如果是的话，Messagebox 显示Hi&lt;br /&gt;
2、检测textbox1之中的text是不是等于Bye，如果是的话，Messagebox 显示Goodbye&lt;br /&gt;
3、如果都不是Hello或者Bye，Messagebox 显示 I don’t understand&lt;/blockquote&gt;
现在这里有3个条件了！&lt;br /&gt;
所以 if .. else 不够用了&lt;br /&gt;
用if .. else if .. else吧！&lt;br /&gt;
if .. else if .. else 很像多个if 一起用&lt;br /&gt;
但是结构会比较清晰&lt;br /&gt;
现在我们先用多个if 来实现&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiWGK4k6-1Fkd1dLRlbUhJIC6oWqCtmFXMC92RKEFRUV8wJKIrQLFqJ574FHrBsZYuIMJ9_p4BmZ_poCWlq5b8IS0dv8Rc6VA1L6WiaPYQavzNkzTcOm-6gH3akhPtQrPKMpMxl-AaNV0Q/s1600-h/image%25255B14%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh36K7q8Or1sTfxe-gpZ_U0ib3I_zgzFFNPAM5Gpr-QDmatqFnrUidykmCkIxO83fH-ghp1ykduaNJXNDXudPQmUW9BG-zlsZv4-AwJc8BKI7N1ZS39HcwKmGX1as1e6p0YSpH01zTO6rs/?imgmax=800&quot; height=&quot;192&quot; style=&quot;border-bottom: 0px; border-left: 0px; border-right: 0px; border-top: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;428&quot; /&gt;&lt;/a&gt; &lt;br /&gt;
然后运行试试看：&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEglkkU5qdA8MSYViYHlD2FTmfI5rSOg6AUdedLghL9DvR5PhxHpXWsKSmlo-AzS2AAf9Kr9xZgZR0wRoL4Rnh70aHA7Vdey0hIjsw5F0h_qX8rXWJMmD-8C8kw4P_aUKuINvsuKDcG7AOk/s1600-h/image%25255B17%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiLXbnXsrGOQTeySCp8JYDfAh_I8n6wnb16RTW58x4Mxft9zXxC-3SSjtFBeddfvx1FMzCptvoj8E1mNuYtWswHMSU3SV-S26QSEP8Rx9Q5Dqcyj9DtuBJ6GoyS2-0SuWY7RyfTGWbarXw/?imgmax=800&quot; height=&quot;313&quot; style=&quot;border-bottom: 0px; border-left: 0px; border-right: 0px; border-top: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;317&quot; /&gt;&lt;/a&gt; &lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhDCXPMsZbWovlCCgA7FZ29iccn2BGIAQkpuPV_Y8ITyt4zZdsLceWbYKgmGlSTlOm2PSQWcVK-DEwgWck2aq9hZGjP6Wnsz49-kOiVQKvfYuW-3NQeDzKbyz9TN1m_IP1lLsaVINe-Go8/s1600-h/image%25255B20%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgZVx4iulWrpWEXalN0suZX23bagPa43N1jRIeqLSAkTNeszOosaQ9z9x7yQVD4Le0uKNkKIsssUD_uImXz8hiO1xoN1YJH8eGmmgX94OXZq4Qj86VUORdlku5GaXF-Mf-PuzKCxaX00uY/?imgmax=800&quot; height=&quot;308&quot; style=&quot;border-bottom: 0px; border-left: 0px; border-right: 0px; border-top: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;306&quot; /&gt;&lt;/a&gt; &lt;br /&gt;
&lt;br /&gt;
但是如果不是Hi或者是Bye，却没有输出！&lt;br /&gt;
你：直接在if最下加入mesagebox 就好了嘛！&lt;br /&gt;
聪明！&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjCLv5siH4TBrqPMwMWympy14zkv6CL8g3BNbWSTPalEM-YMxBnT1b46-OdlGpTLCu87E4NDqOSDm4TE6Fxh1sF0ilGK1H9OgcO4UL7KoLjgZ55QLRhA3LPStTSVrf_ByHvLA8A71SHP2k/s1600-h/image%25255B26%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhY3FYlMkCbbW8YNjhpNoIxfuwuwxZP2TKVqbB4db4V1UvBNuoyeJHFrnbiEyCvFtgEhvLX8ae4-4FNb8ggecoMVLn34waaifhkDo3TaszeKBloCQsi2JVOfLjSnog4sft8IDXiurlniAg/?imgmax=800&quot; height=&quot;214&quot; style=&quot;border-bottom: 0px; border-left: 0px; border-right: 0px; border-top: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;433&quot; /&gt;&lt;/a&gt; &lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjVYmZDeke_W0HSQj14do9VepFZ8iu0Z8HugJub-RZmZFzcVyRiwGzHPt7u8B-z0f8_h4B5meVwTH0xlcPcOWty5kQTjW1Zuyj6nY-dc-7gaWezMT2Z5YjYIa63fDwS_pJiknT8j_PwZZo/s1600-h/image%25255B29%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhLmuywFdSMbCeCvsA_WJlwfO46IM5deoshlCDZ7N4HoX_bZltLkPAGaUHL9czvgFYvnayMRnFBp4dNy_Ax_tYVJrKXzspHMud5l3STxy1KoYN8-rJ3UgG-B7M9MYIxMynVx2VYujc4zpnv/?imgmax=800&quot; height=&quot;312&quot; style=&quot;border-bottom: 0px; border-left: 0px; border-right: 0px; border-top: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;307&quot; /&gt;&lt;/a&gt; &lt;br /&gt;
&lt;br /&gt;
但是一样的，多个if 就等于要有多个检测！&lt;br /&gt;
所以我们改成用if .. else if .. else 的话就变成了&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhMDhPf4AHyfolvyjZYedBdi2r_P-LHMhYmko8WnuI-wdHZTeUXCxqfYnh_XX6Hn2_N5sp7KszjPBjQnyKuaN5udP-7cpkux-g15OckasNLAHW4kxXuUKSn9sV5siz45DehDKGO70Lcv_4/s1600-h/image%25255B32%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiJmfHW-7yR0UAjf6aAWWDkEkIwv9HY9M96_h6jbsZ6kcNAKgDq88F-QuwpoXQjfvzkcBRzOuV2N41dNeMHKwGhbpo7CGBmN5vO4IMMteBoyCWqDa0h3NUvv0pyaj_0CyYSwvOSt79zejY/?imgmax=800&quot; height=&quot;238&quot; style=&quot;border-bottom: 0px; border-left: 0px; border-right: 0px; border-top: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;447&quot; /&gt;&lt;/a&gt; &lt;br /&gt;
如果是Hello，messagebox显示 Hi&lt;br /&gt;
如果是Bye ，messagebox 显示 Goodbye &lt;br /&gt;
如果都不是Hello 或者bye，Messagebox 显示 I don’t understand&lt;div class=&quot;blogger-post-footer&quot;&gt;&lt;script&gt;
SyntaxHighlighter.highlight();
var linkwithin_site_id = 1130633;
$(&#39;#toTop&#39;).remove();
$(&#39;body&#39;).append(&#39;&lt;div id=&quot;toTop&quot; onclick=&quot;$(\&#39;html,body\&#39;).stop().animate({\&#39;scrollTop\&#39;: 0})&quot;&gt;Top&lt;/div&gt;&#39;);
$(window).on(&#39;scroll&#39;,function(){
if ($(this).scrollTop())
{
$(&#39;#toTop&#39;).fadeIn(&#39;fast&#39;);
}
else
{
$(&#39;#toTop&#39;).fadeOut(&#39;fast&#39;);
}
});
&lt;/script&gt;
&lt;script src=&quot;http://www.linkwithin.com/widget.js&quot;&gt;&lt;/script&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://garyngzhongbo.blogspot.com/feeds/2887398668369177064/comments/default' title='博文评论'/><link rel='replies' type='text/html' href='http://garyngzhongbo.blogspot.com/2013/11/c-8ifelse-ifelse.html#comment-form' title='0 条评论'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5319618319979683940/posts/default/2887398668369177064'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5319618319979683940/posts/default/2887398668369177064'/><link rel='alternate' type='text/html' href='http://garyngzhongbo.blogspot.com/2013/11/c-8ifelse-ifelse.html' title='[教程][C#] 新手入门教程#8——if..else if..else'/><author><name>Gary Ng</name><uri>http://www.blogger.com/profile/00014057672539539340</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjsMIhfx-Km5D79jBvV9hADWCLrksc-rYNAT6Vrehs575DMj7shNmTjX2w_1K8wTM18Wi1km7505SQIxLzTa1aBG5LR6FvcHOUtZVbBSwkB5MnIvk6F8GbaWlBo80Uav4N6RnY1ZnqvTt8/s72-c?imgmax=800" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5319618319979683940.post-8339345304747209892</id><published>2013-11-21T19:34:00.000+08:00</published><updated>2013-11-21T23:04:25.778+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="C#"/><category scheme="http://www.blogger.com/atom/ns#" term="入门"/><category scheme="http://www.blogger.com/atom/ns#" term="原创"/><category scheme="http://www.blogger.com/atom/ns#" term="教程"/><category scheme="http://www.blogger.com/atom/ns#" term="新手"/><title type='text'>[教程][C#] 新手入门教程#7——初识If Statement + .ToString() 方法</title><content type='html'>之前在教程#5 你认识了那帅帅的MessageBox，而且知道了如何更改MessageBox的显示按钮（OK、Yes、No等等），于是你又问问题了&lt;br /&gt;
你：如果用户按下Yes的话，我就MessageBox弹出“Yes”，按下No的话，就MessageBox显示“No”要肿么样呢？&lt;br /&gt;
我们来分析（或者说写“伪代码”，就是不是代码的代码）：&lt;br /&gt;
&lt;blockquote&gt;
如果 用户按下“Yes”按钮&lt;br /&gt;
让 MessageBox 显示“Yes”&lt;br /&gt;
如果 用户按下“No”按钮&lt;br /&gt;
让 MessageBox 显示“No”&lt;/blockquote&gt;
我：如果的英文叫啥？&lt;br /&gt;
你：If！&lt;br /&gt;
我：厉害厉害！&lt;br /&gt;
先让我们看看MessageBox的代码咋写：&lt;br /&gt;
在Windows Form 上添加一个Button&lt;br /&gt;
然后双击Button&lt;br /&gt;
先写个MessageBox，显示“Yes/No”&lt;br /&gt;
标题为“If Tests!”&lt;br /&gt;
然后设置显示的按钮是Yes和No罢了：&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjv4q0V2thsYq5qXAVu0BSwixqFas72hZlDqHuM4CY7xndBhNDVxK7gl0DX3YXDjnsnGBWaHaJhcKVeYPSbbuSxhmXQUG8KIrz3eLEaA4EnR1htXnYvPIhed68yyC5F544PtjD_vGSa6l8/s1600-h/image%25255B2%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg9qXlHU3UIOqypt5hQRGwj2jyRdhaHWpWOv4zUHFR4owlBBA8YIQHlRfvORvtpTFvbmtRs0wegPuGctQuq4YGNjW_0p8ndsC2zUMFzyFUQFFxNujy43SYwq4swN5c8MXLGL1iqAKn2JjU/?imgmax=800&quot; height=&quot;96&quot; style=&quot;border-bottom: 0px; border-left: 0px; border-right: 0px; border-top: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;484&quot; /&gt;&lt;/a&gt; &lt;br /&gt;
&lt;br /&gt;
MessageBox 在用户点击的时候就会返回一个enum（先别管这个是啥）&lt;br /&gt;
用来表示用户点击了啥按钮&lt;br /&gt;
用来看MessageBox点击了什么按钮的方法就是：在用一个MessageBox来显示！&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjBeQfz_6WvJiNPWuWkNFMRdK4AqA9_Vxjz3-op9g8xKyAXoN087noNEzOLkpDsmlpoXa7snoyPWptzx5h5Rmryv-LqBncg0Or_owlHTi24XfewNDan2ZKnZlHS9IdjgEgzt8AtjQU7auE/s1600-h/image%25255B5%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEheLdNvgiPUK8m7rKVlp6DRKZ9fW-sN4in7QxlvrEruFqJPhtK5xgPiwuBH4WhBdR0prq_b6Lrskp2A27oJMtrcs7ymtZIvhJLXNgq8BpE_-z5g2wPVYnZ1ePQ7QqzfYePawVLukIIm-Pg/?imgmax=800&quot; height=&quot;86&quot; style=&quot;border-bottom: 0px; border-left: 0px; border-right: 0px; border-top: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;697&quot; /&gt;&lt;/a&gt; &lt;br /&gt;
这里的.ToString()是一个方法（Method，或者是Function），它能（很神奇的）把所有object 转成String，为什么要转成String呢?因为MessageBox只接受String咯！&lt;br /&gt;
按下F5编译运行试试看：&lt;br /&gt;
点击Button就会看到这个MessageBox：&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg0m7jAi2dpZp6w3dzR8oWpPRXN-NWr_hERIfTJHfqrCXiq4mvmQs-E340lsGvkQQJMtu8hkYlwNds1vAufooLcWWkyB3UbYxaA3AAFkCVLXsiJ9n6Ljf8sZ-VRGtbzUsZUHTnpM_abXNM/s1600-h/image%25255B8%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj92Fyo1yb40esBPlc-9lSpoYzAaHY73WWmfTfS7UoAeLBMZSUj5eMv1mh753F4pkzmFX-a6c0zxXkk_9ynpDrnnFKReGklUhvihqwOP0Bi_r5plCjvaieGJ12WNKbWqbUvtErUNZRbuvA/?imgmax=800&quot; height=&quot;315&quot; style=&quot;border-bottom: 0px; border-left: 0px; border-right: 0px; border-top: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;302&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
试试看点击“Yes”&lt;br /&gt;
就会有另外个MessageBox弹出，显示你刚才点击的按钮：&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjBTyqfoIsKklGqxRN8eEgRmCR7rivleTS0nRK0hdLbo_G56TYes5bSj9b-j2u9TpgEPTcpFqaujraTPrWXUI38ayVQQm5uPuh2IbATy9N_olu-XniSDxDs2DGkC3S-5UruIYuD3fdsGBo/s1600-h/image%25255B14%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj3NIdwT1_VI2vmpz20q-2HbYas0OcR9SfHkCotMB3q3H2lZNeqfYVA23UiJH55VaEeFc0ooF_B701ymMB1ZQlwF5GF2XlSgbIT3VzZo3BNd7Ki84IBzV9Zkp6DmnMmIBbAhvx4Juc6G3R8/?imgmax=800&quot; height=&quot;301&quot; style=&quot;border-bottom: 0px; border-left: 0px; border-right: 0px; border-top: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;306&quot; /&gt;&lt;/a&gt; &lt;br /&gt;
雷吧？&lt;br /&gt;
你：我不要MessageBox里面又有MessageBox的啦！我不要我不要！&lt;br /&gt;
好吧，教程#5教过用变量了吧？&lt;br /&gt;
现在用吧！&lt;br /&gt;
我们知道&lt;br /&gt;
&lt;pre class=&quot;brush: csharp&quot;&gt;MessageBox.Show(&quot;Yes/No&quot;,&quot;If tests..&quot;,MessageBoxButtons.YesNo).ToString() 

&lt;/pre&gt;
&lt;br /&gt;
&lt;script type=&quot;text/javascript&quot;&gt;
SyntaxHighlighter.highlight();
&lt;/script&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
是string吧！创建一个string变量来储存MessageBox返回的参数&lt;br /&gt;
然后在用MessageBox show 那个变量里面的值：&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgIZ_esGPmJWlFl_mYM_Yo5pd1tBN0a5lJLahfNrirSBZd88KRn1NbrlGvkr_8f2Jxv7Yrd9h3JwrJs6AGebXsFGbWePrbgNieU1up1HgZhyphenhyphenW0X-KoSwXEWBjAfJxdwXCmEBiqYbBzIZBI9/s1600-h/image%25255B20%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgIrVd8AElsy1hMAjLyJvVDlq-00OvSUufvmF3O0LIRYkie9lOWNaiWrdDk8X4yNRn8MKBJYneryS5Va7f7JhI0uhR34Aj825AWz8bKrjIORhNFjTbgVh2Oo3wci4GU2KVpnsXCI5moponr/?imgmax=800&quot; height=&quot;198&quot; style=&quot;border-bottom: 0px; border-left: 0px; border-right: 0px; border-top: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;635&quot; /&gt;&lt;/a&gt; &lt;br /&gt;
好啦好啦：&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjRxdGzcHuJH4lqquA8Qx1PUcSDpsWg0ICsGuhLOO4VNbDkmCvH4n_MkwFg8hSu48yBfAC9am6OHjeIdGy7njAPrx-fvDdAPX5lCilqt9btZjKKfu5BaTe1B0yM3tkstlMAo6SCrwqM5Is/s1600-h/image%25255B23%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgM8u7DIxEdXFDsqI94HzLZcHTCowFYyEk0SLarGLSxIfv64xjlAAkdihF3Cnx6o2Hx2jJ1vBJLzxu34RgZSY74a0t6vLvHzMUW-pA_8MXCIV4WYuSqs1pAYyFmInHZ83FaLlsfwga3TfA/?imgmax=800&quot; height=&quot;90&quot; style=&quot;border-bottom: 0px; border-left: 0px; border-right: 0px; border-top: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;701&quot; /&gt;&lt;/a&gt; &lt;br /&gt;
运行！&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhPrBUudW-cgIKMXvAC9pI_udQ2NzpUnQw0X04CP46mrNWHfT-ebCB3i6nafwfaYQ-Fvqw8PoXXXUAWSdLf_jEcWlUc8_LiJIJuny65H_jhRDTy_ooOEsPti3MECYGLcQZ5XS6-YZkF6rY/s1600-h/image%25255B26%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjrCVfKVxcNl1XZegFu52o9nk6HNAEIXE-UrHXmGDMhEjWomDZoai_DVl3dd_2v2eJXEfZQniOk_60aM89D_GHDJI3WHKLzcsOTb7b-qqgQcSkkpphwb5bLUBj4cPOHn0HmXbEMDq1QE-E/?imgmax=800&quot; height=&quot;305&quot; style=&quot;border-bottom: 0px; border-left: 0px; border-right: 0px; border-top: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;304&quot; /&gt;&lt;/a&gt; &lt;br /&gt;
然后：&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhDz2UrCy80GDXg8F8zKmgjBNrwocHJa_JMJOIUsRa8YC0cJ8YR2uNuEOuxHuXmAoelFkiC_FslqfATIiXZj8lHpdg5lU_VfwRwCF914Ldx3F53MIMKYWudWAUQyZA_iDWP25tw7C-prMo/s1600-h/image%25255B29%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjBTkDbt9V7NHZHUuSwVmXUuww7y0bSFiWc_n7tKRgnEieTOpvJ-k37fokHWBsCSdmHCFOH7RrpKjUtGgHijhzUyIRSYMhm5QbUPqRyG3tCAsner4Lc1jQStPotZLKs9ke5bOJA5Q76Aco/?imgmax=800&quot; height=&quot;299&quot; style=&quot;border-bottom: 0px; border-left: 0px; border-right: 0px; border-top: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;297&quot; /&gt;&lt;/a&gt; &lt;br /&gt;
&lt;br /&gt;
你：Where is my IF ?&lt;br /&gt;
正题来了，先删除之前写过的代码，我们“砍掉”重练！&lt;br /&gt;
if 的格式是这样的：&lt;br /&gt;
&lt;pre class=&quot;brush: csharp&quot;&gt;if ( Boolean Expression)
{
    //Body
}
&lt;/pre&gt;
而 &lt;br /&gt;
&lt;pre class=&quot;brush: csharp&quot;&gt;//Body
&lt;/pre&gt;
里面就是当Boolean Expression 为True 时运行的代码&lt;br /&gt;
你：Boolean Expression是啥？&lt;br /&gt;
Boolean Expression就是多个relational operator 组成的“公式”：&lt;br /&gt;
假设我用有&lt;br /&gt;
&lt;blockquote&gt;
变量A = 20&lt;br /&gt;
变量B = 30&lt;/blockquote&gt;
&lt;br /&gt;
&lt;table border=&quot;0&quot; cellpadding=&quot;2&quot; cellspacing=&quot;0&quot; style=&quot;width: 910px;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt; &lt;td valign=&quot;top&quot; width=&quot;84&quot;&gt;Operators&lt;/td&gt; &lt;td valign=&quot;top&quot; width=&quot;412&quot;&gt;Description&lt;/td&gt; &lt;td valign=&quot;top&quot; width=&quot;412&quot;&gt;Example&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt; &lt;td valign=&quot;top&quot; width=&quot;84&quot;&gt;==&lt;/td&gt; &lt;td valign=&quot;top&quot; width=&quot;412&quot;&gt;如果两边（就是&#39;==&#39;的之前和之后）&lt;strong&gt;相等&lt;/strong&gt;，就返回True&lt;/td&gt; &lt;td valign=&quot;top&quot; width=&quot;412&quot;&gt;(A == B) 为 False ，A 不等于 B&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt; &lt;td valign=&quot;top&quot; width=&quot;84&quot;&gt;!=&lt;/td&gt; &lt;td valign=&quot;top&quot; width=&quot;412&quot;&gt;如果两边&lt;strong&gt;不相等&lt;/strong&gt;，返回True&lt;/td&gt; &lt;td valign=&quot;top&quot; width=&quot;412&quot;&gt;(A != B) 为 True，A 不等于B&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt; &lt;td valign=&quot;top&quot; width=&quot;84&quot;&gt;&amp;gt;&lt;/td&gt; &lt;td valign=&quot;top&quot; width=&quot;412&quot;&gt;如果&lt;strong&gt;左边大过右边&lt;/strong&gt;，返回True&lt;/td&gt; &lt;td valign=&quot;top&quot; width=&quot;412&quot;&gt;(A &amp;gt; B) 为 False， A 小过 B&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt; &lt;td valign=&quot;top&quot; width=&quot;84&quot;&gt;&amp;lt;&lt;/td&gt; &lt;td valign=&quot;top&quot; width=&quot;412&quot;&gt;如果&lt;strong&gt;左边小过右边&lt;/strong&gt;，返回True&lt;/td&gt; &lt;td valign=&quot;top&quot; width=&quot;412&quot;&gt;(A &amp;lt; B) 为 True，A 小过 B&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt; &lt;td valign=&quot;top&quot; width=&quot;84&quot;&gt;&amp;gt;=&lt;/td&gt; &lt;td valign=&quot;top&quot; width=&quot;412&quot;&gt;如果&lt;strong&gt;左边大于等于右边&lt;/strong&gt;，返回True&lt;/td&gt; &lt;td valign=&quot;top&quot; width=&quot;412&quot;&gt;(A &amp;gt;= B) 为 False&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt; &lt;td valign=&quot;top&quot; width=&quot;84&quot;&gt;&amp;lt;=&lt;/td&gt; &lt;td valign=&quot;top&quot; width=&quot;412&quot;&gt;如果&lt;strong&gt;左边小于等于右边&lt;/strong&gt;，返回True&lt;/td&gt; &lt;td valign=&quot;top&quot; width=&quot;412&quot;&gt;(A &amp;lt;= B) 为 True&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;br /&gt;
很&lt;span style=&quot;font-family: inherit;&quot;&gt;像数学对吧？&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;现在来看看基本的if 如何写：&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;定义两个int 变量，&lt;/span&gt;&lt;br /&gt;
&lt;blockquote&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;A 为 20&lt;/span&gt;&lt;br /&gt;
B 为 30&lt;/blockquote&gt;
（就像上面那样）&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjGVCRzCaZ8TJenZFH-p4yZVxpYcVOkDHYuq18mmQUnNBmSpn7HI8L1O954_IZRTEh75q4utKpG18JhUnplmXsyEh-nkj95GJ5Qj3eh_tCqj6LJ0DDe-S3Y_IEBAjWZ7DwGbYk733uUZQsz/s1600-h/image%25255B32%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgd-HA42Ic4xcbifXXn01Ec40EvgEyzgytGKaQ_ikqXpN7LzolEFdTTbY_70Ss1ZBlPVavy-RRch6-RvUEX93fl0CCxPuQWYL5ECXdeCfm0v-ILu3ccQ14AXpfwaEy1ISDLwz8ScnKDWQY/?imgmax=800&quot; height=&quot;94&quot; style=&quot;border-bottom: 0px; border-left: 0px; border-right: 0px; border-top: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;406&quot; /&gt;&lt;/a&gt; &lt;br /&gt;
&lt;pre&gt;现在来看看 == 运算符吧&lt;/pre&gt;
&lt;pre&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiGq0__5gNz0wmi11wwu2NlNbZUhmzOFUrSACYsiLSTlZms1A2J03og9_kKOMvZCCgm3nt8vDOXqBsymKL0-TNSlhiV13JPXemu2z7Yw9pYVs4fhhA982U4fF1f2MIeQccv5VhcaXOQCj0/s1600-h/image%25255B38%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjAUI8EMsRA11BvTouM7MVa1tJv2kUWpFwaBSFFEc5AoWh9JusBmiVqd-goKz41CW6NFzyA2yA2lc8go6ecoa7m2TR5Okd36etaqmNSsrqCVR4qtzUPuZLg8YSe8KvvzhxEdX7HY9ZnFSY/?imgmax=800&quot; height=&quot;156&quot; style=&quot;border-bottom: 0px; border-left: 0px; border-right: 0px; border-top: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;404&quot; /&gt;&lt;/a&gt; &lt;/pre&gt;
&lt;pre&gt;&lt;span style=&quot;font-family: Times, Times New Roman, serif;&quot;&gt;然后运行看看&lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;span style=&quot;font-family: Times, Times New Roman, serif;&quot;&gt;MessageBox 并没有弹出来&lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;span style=&quot;font-family: Times, Times New Roman, serif;&quot;&gt;你：为啥？&lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;span style=&quot;font-family: Times, Times New Roman, serif;&quot;&gt;我：因为A 不等于 B 咯！&lt;/span&gt;&lt;/pre&gt;
&lt;br /&gt;
再试试!= 看看：&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiVzLAPVs5NPGshU2I4a1IiTDYCVMS5wlF-uI_SsAsByFnL3HqezTkgD4busM5iEKY2-gVgYFbu4h6TVmHxQcSoHFn44MHfeBcJ1K-w8mX0fcQYwMehUgEtHQQJe10lPlQ-nPhwj_l4ZvuV/s1600-h/image%25255B41%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj2uI9MAX1b_kcNlWh59vj0aKe2-3pdb6gl6XjsxTY_EXArrENBiEdraMmwvJn0miOvFzy9Nyy2k2ZbjtMJb6c2gfzrVni2SFAl7E1gmDwMSrvrGFI2fQpzhZW9OqMNcPaJv99isEHSRr2b/?imgmax=800&quot; height=&quot;146&quot; style=&quot;border-bottom: 0px; border-left: 0px; border-right: 0px; border-top: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;403&quot; /&gt;&lt;/a&gt; &lt;br /&gt;
&lt;br /&gt;
然后运行：&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjdBE-1xzFV_mWBIg-8IFgD0YeihQcQJR4dRA8-7sEAS-hwle8m2PjVPe2WxAVZaOxkraD2WXVllca9OzZvzcX2GPNOlbNyOhiGb7bjlHsF6FpTBfuxJsHd2A6u3JIHG_WRzXCd9SicNSl9/s1600-h/image%25255B44%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiz-Je__a7ufYvmpSrrkCotuIOoc2pQ95-TLVnLa4YO7GiPnRn4JprkYucv_JoQHmfaEuLLC5wcO7cIXSLeDI2LFifg0L5EGRqQp08RY23okdZfA3k-EVN8q87Ck12eJ-ICKF0Pk_hruIAF/?imgmax=800&quot; height=&quot;304&quot; style=&quot;border-bottom: 0px; border-left: 0px; border-right: 0px; border-top: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;305&quot; /&gt;&lt;/a&gt; &lt;br /&gt;
&lt;br /&gt;
明白了么？&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
要如何判断用户点击了Mess&lt;span style=&quot;font-family: Times, Times New Roman, serif;&quot;&gt;age Box &lt;/span&gt;上的什么按钮呢？&lt;br /&gt;
&lt;br /&gt;
你可能会兴奋地写出：&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi1HLjoVrU6eQ-ekkGKo1HDPUlpSXfFf1r4BlPQ70u7lmVdOhoSb4LWtHY_QMrhAVIVkz1VfkFaTq95rJgsvN9LBLEL_QnNeXvfOiv5xgyuabjeHB5nfIuh1JqvlqqzbqRnPi6oX_M5glLy/s1600-h/image%25255B65%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgy6gjtqwI_YNa_vIhP2djc8oIRp4Vbnhd5X-aEtvr9pk2TDGBICqD3bf9HEBXhlKoPkRWUHXNVqlfyC6ai55IoRLGaxVxohCP3Cfo-FRCGdw1LMG3R0YON3k1dbDYCx08sYbACV-XmqlCn/?imgmax=800&quot; height=&quot;197&quot; style=&quot;border-bottom: 0px; border-left: 0px; border-right: 0px; border-top: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;636&quot; /&gt;&lt;/a&gt; &lt;br /&gt;
&lt;br /&gt;
恩！&lt;br /&gt;
&lt;br /&gt;
很好！&lt;br /&gt;
&lt;br /&gt;
但是还能更好！&lt;br /&gt;
&lt;br /&gt;
Message Box 返回的value 是一个 DialogResult&lt;br /&gt;
&lt;br /&gt;
像这样：&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhNMvqSrsxh6mbnCldej5hcsss3nv8D9DtAbRpJ1OQoaPaOUtF8KGR0ZjTih5b2YMrEbmGK4nKQaonJNg6f4IZnkhzCXLSlh4y7BxcG9-_ke-9gGkoZG5uJ0aS_MXBCN-8yH9H9jgZKuvo/s1600-h/image%25255B74%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgWBOxXvPNzhqe7EVJEMI9UhzmmitLEgMIosqBZzmTHFvWMH47386Aa-kb4RIujDpKLieSIejYu3dKL9eaHbPZC9tcfKvIw6vlNpZkjXYuT68fz3dE2e484SNBCVQ9gnZl_O_eVcSgEUSRA/?imgmax=800&quot; height=&quot;237&quot; style=&quot;border-bottom: 0px; border-left: 0px; border-right: 0px; border-top: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;877&quot; /&gt;&lt;/a&gt; &lt;br /&gt;
&lt;br /&gt;
DialogResult 里面有很多成员（members），我们要的是Yes：&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEguTxCXCqFzao-joRuPrJ1SiifWjZhy0jSnY3vT6tcILph0ufvrI4bH7M7WwaU0hghGv86CF6odNlrRQb-X-JDrT2TsgrCsbINITqNu7hjeMzoXy1HBz9QhsCHsOM7GcjXqcM9jdQbDP9N3/s1600-h/image%25255B77%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiWhNnr7HzkQOBwLLzAgfEaffnKeNhf2sQCWpZNwqW_mgU8jsOEJtXIGqQF6FXotuxVnrLInHjuLFz0lui8Gy8FW0nDKzHRwLBOjbiC-Xfg-9bFxn76TrpzznQUln80AdDmQ7ADrQIbmFs/?imgmax=800&quot; height=&quot;240&quot; style=&quot;border-bottom: 0px; border-left: 0px; border-right: 0px; border-top: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;850&quot; /&gt;&lt;/a&gt; &lt;br /&gt;
&lt;br /&gt;
然后显示一个MessageBox：&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgQm43iaEXjfx9RTleNlXN68Xln3XqeEH-L79pFs6_A2pLQyvds2Au9w2AVb_l_dSnH2kQq3MlNGwxbNuDYoJA8OtlAZgcwahZ6cTrEcc_gajOgM2hgCNvhSl5XiKAU9IUkVVbBmQG00Mo/s1600-h/image%25255B80%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj7Z8SaSchgYXcbx-pUKpAvJbHsyuZUUFXe94PbKHo0Xlehxz_LAcVYUSqCfx4soxyigGrVzl8angpc5PKyTModl4nyN6vnEwucxem22DApqk4SVb3MxvYNe1h3gGVqKRb4XgaoFdW8Hxnf/?imgmax=800&quot; height=&quot;124&quot; style=&quot;border-bottom: 0px; border-left: 0px; border-right: 0px; border-top: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;824&quot; /&gt;&lt;/a&gt; &lt;br /&gt;
&lt;br /&gt;
当然别忘了处理用户按了 No 按钮：&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi6FHFQsPw1X6o6u7absaIIvVuYybrtlWbKQM-J3M9Eq-vUV15O1fGeHVSaAzgzx0k1cBz9zHzhftJ7c_W-LmPyTyslZTryCLGVpJoJYePAMnpPw8hxMPvPnypaOQ9nTDeNlw2E43TrEjQ/s1600-h/image%25255B83%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiRcZt_84g0Tt2THueUaf6iApGksfxDEtDb_uDBBAaL6YYUYcZc3KAiBANvPxo1sbSWSAZ28WK0DX07MekRiPYUE56V2foOE_qqGMvM5YQ9Y_ppaxKx91uUMlzu_nKLBTU5NqyCF9pXPX1Z/?imgmax=800&quot; height=&quot;180&quot; style=&quot;border-bottom: 0px; border-left: 0px; border-right: 0px; border-top: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;795&quot; /&gt;&lt;/a&gt; &lt;br /&gt;
&lt;br /&gt;
F5 编译运行后，你会发现&lt;strong&gt;竟然有2个MessageBox 跳出来！&lt;/strong&gt;&lt;br /&gt;
&lt;br /&gt;
为啥？&lt;br /&gt;
&lt;br /&gt;
因为我们打了2次MessageBox.Show啊！&lt;br /&gt;
&lt;br /&gt;
所以要用变量！变量！&lt;br /&gt;
&lt;br /&gt;
你：MessageBox 返回是什么类型的啊？&lt;br /&gt;
&lt;br /&gt;
我：就是DialogResult啊！&lt;br /&gt;
&lt;br /&gt;
所以我们的变量类型是DialogResult！（有点点奇怪对吧？）&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiqmZPjxjbfho0QJ-Ow8L8iqpSAObF_vrM1a05gLY7Zq40sKyv_9kHkBjFI8PtlSggCO1YZfv43-RcLFL8cSWCOeJYPu3jjnro4PERSN8LmJqMovQu0CuQeq7HTBYveCQgvhD745t3tVbbe/s1600-h/image%25255B86%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEigr2dW6P0cNtNDp8Yl7TeawR06l7ldkOjQAPLBwHDtu43Sm5pCU8j5rO5vsMvAVze1_KXBurfMWpaDY4UYyZ2A0IuoUY89YlHjTcDl8e5GgtfvBJY__hBtJeNHBpeLgUCNG3sfSkiiDIs/?imgmax=800&quot; height=&quot;181&quot; style=&quot;border: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;640&quot; /&gt;&lt;/a&gt; &lt;br /&gt;
&lt;br /&gt;
然后把两个if 里面的 MessageBox.show 换成 msg 变量：&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgYofQj7LI-8xUS5Cu-6eLTDjhfRFbuBDm371i-JrfMZeuKCaiJYYUwDEGrejfeUe_S8bpvlrlJzjM5Kg0C8cWOtEqrC9RKi2cDC_j3Man4l9JbMukQQpXaolMDYWdAzbR7ksebd3ZmjTs/s1600-h/image%25255B89%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiVW4JMPhDZbiYwBrx_srWBVfOsxKTYqqUw7iKnf4XoQE6SVgpsXJ6UpH7sSe_oB7rp10Tr6mIAywnKgKR5sc1LSZ_prOA6IkwXp1-Xv-ja6rEKZL2-s458DuXJFW_t242y0bAjCGyjsIJb/?imgmax=800&quot; height=&quot;233&quot; style=&quot;border-bottom: 0px; border-left: 0px; border-right: 0px; border-top: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;605&quot; /&gt;&lt;/a&gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
完美运行！&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjshFQl2m9vee4DV8jpftNzcAEWShjiu0tvNuW-eRFMbDJrNiYexnjDi75g_io7xiq4SjNnE1YsUjXIlmNm5BqvXErWWHbMtBhNziGPO7ZVestuBK9D_lSsxinDDipRz6tGvIrVoOs5k10K/s1600-h/image%25255B92%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiL2F-ZdDI0hbhQTlP6xKbgRYYiSzi9PLHwUGswjOKKnAYgc9Ecl5I-3r91hC9rtjoznPSUpi7d770aB7rlIIhV7kFBfW-XK62lsNoDE9PZI_qtqv5GTeD0Cs6Xhlm5f08sG57J024kuRA/?imgmax=800&quot; height=&quot;304&quot; style=&quot;border-bottom: 0px; border-left: 0px; border-right: 0px; border-top: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;362&quot; /&gt;&lt;/a&gt; &lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj2GacPGVFEii1qSQULL7WX6am_TLhMV4EFYXraUDKH_Vt4e9MSo2hXzyb_Bsc_G_oBabuBWUs9EJkpeC1HEinB5RlRZ0Rvadh4_-Z1YfJHQmRAdfsIQ71RYvR8mF2KkQgD0kFSElvoc3M/s1600-h/image%25255B95%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhdoP20SAgmSnELnx9DFW1gTOLqTX1ueNlCj0gcn0Bfl5ZMATuiCGcoE8-K4soOGh0fXOsqPLzZJVvOmerMRLAeSrVedJyVDnLZf_p9lBxhPR9a0YQeaX61HIFGYNhjWSggEL1y1YKvb5GX/?imgmax=800&quot; height=&quot;298&quot; style=&quot;border-bottom: 0px; border-left: 0px; border-right: 0px; border-top: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;305&quot; /&gt;&lt;/a&gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-size: xx-small;&quot;&gt;PS: 我是不会让你知道其实还有&lt;strong&gt;更简单&lt;/strong&gt;的&lt;strong&gt;if.. else..&lt;/strong&gt; 写法！&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;div class=&quot;blogger-post-footer&quot;&gt;&lt;script&gt;
SyntaxHighlighter.highlight();
var linkwithin_site_id = 1130633;
$(&#39;#toTop&#39;).remove();
$(&#39;body&#39;).append(&#39;&lt;div id=&quot;toTop&quot; onclick=&quot;$(\&#39;html,body\&#39;).stop().animate({\&#39;scrollTop\&#39;: 0})&quot;&gt;Top&lt;/div&gt;&#39;);
$(window).on(&#39;scroll&#39;,function(){
if ($(this).scrollTop())
{
$(&#39;#toTop&#39;).fadeIn(&#39;fast&#39;);
}
else
{
$(&#39;#toTop&#39;).fadeOut(&#39;fast&#39;);
}
});
&lt;/script&gt;
&lt;script src=&quot;http://www.linkwithin.com/widget.js&quot;&gt;&lt;/script&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://garyngzhongbo.blogspot.com/feeds/8339345304747209892/comments/default' title='博文评论'/><link rel='replies' type='text/html' href='http://garyngzhongbo.blogspot.com/2013/11/c-7if-statement-tostring.html#comment-form' title='0 条评论'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5319618319979683940/posts/default/8339345304747209892'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5319618319979683940/posts/default/8339345304747209892'/><link rel='alternate' type='text/html' href='http://garyngzhongbo.blogspot.com/2013/11/c-7if-statement-tostring.html' title='[教程][C#] 新手入门教程#7——初识If Statement + .ToString() 方法'/><author><name>Gary Ng</name><uri>http://www.blogger.com/profile/00014057672539539340</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg9qXlHU3UIOqypt5hQRGwj2jyRdhaHWpWOv4zUHFR4owlBBA8YIQHlRfvORvtpTFvbmtRs0wegPuGctQuq4YGNjW_0p8ndsC2zUMFzyFUQFFxNujy43SYwq4swN5c8MXLGL1iqAKn2JjU/s72-c?imgmax=800" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5319618319979683940.post-5030252061419731370</id><published>2013-11-20T11:36:00.000+08:00</published><updated>2013-11-20T11:36:57.208+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="C#"/><category scheme="http://www.blogger.com/atom/ns#" term="入门"/><category scheme="http://www.blogger.com/atom/ns#" term="原创"/><category scheme="http://www.blogger.com/atom/ns#" term="教程"/><category scheme="http://www.blogger.com/atom/ns#" term="新手"/><title type='text'>[教程][C#] 新手入门教程#6——初识变量、数据类型</title><content type='html'>你的一只脚开始踏入编程的门槛内了！&lt;br /&gt;
&lt;h1 align=&quot;center&quot;&gt;
【变量？变量！】&lt;/h1&gt;
&lt;div align=&quot;left&quot;&gt;
你：变量是啥？变量是啥？告诉我呀！&lt;/div&gt;
&lt;div align=&quot;left&quot;&gt;
我：恩..变量..变量..&lt;/div&gt;
&lt;div align=&quot;left&quot;&gt;
你：（一巴掌过来&lt;/div&gt;
&lt;div align=&quot;left&quot;&gt;
我：..变量，你可以想象成一个大桶，里面有水，水的分量呢，由你而定，你可以随时倒掉一些水，或清空它；或者你可以加进一些水..这就是变量。&lt;/div&gt;
&lt;div align=&quot;left&quot;&gt;
变量是某种数据的载体，用来储存数据用的（废话），但是变量的值（也就是桶里面装的水），可以随时改变，所以才叫“变”量嘛！&lt;/div&gt;
&lt;div align=&quot;left&quot;&gt;
C# 内的变量有很多类型，就像不同的桶只可以装特定的东西——垃圾桶啥都装、笔筒只放笔、水桶装液体等等&lt;/div&gt;
&lt;h1 align=&quot;center&quot;&gt;
【数据类型】&lt;/h1&gt;
&lt;div align=&quot;left&quot;&gt;
我们深入谈变量之前，先来了解数据类型，也就是“桶的种类”&lt;/div&gt;
&lt;div align=&quot;left&quot;&gt;
C#有不同的数据类型，这里我列出并解释一些：&lt;/div&gt;
&lt;div align=&quot;left&quot;&gt;
&lt;strong&gt;1、bool&lt;/strong&gt;&lt;/div&gt;
&lt;div align=&quot;left&quot;&gt;
&lt;strong&gt;- Boolean&lt;/strong&gt;&lt;/div&gt;
&lt;div align=&quot;left&quot;&gt;
- 储存 true或者是 false&lt;/div&gt;
&lt;div align=&quot;left&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div align=&quot;left&quot;&gt;
&lt;strong&gt;2、byte&lt;/strong&gt;&lt;/div&gt;
&lt;div align=&quot;left&quot;&gt;
&lt;strong&gt;- 8-bit unsigned integer&lt;/strong&gt;&lt;/div&gt;
&lt;div align=&quot;left&quot;&gt;
- 储存0 到255&lt;/div&gt;
&lt;div align=&quot;left&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div align=&quot;left&quot;&gt;
&lt;strong&gt;3、char&lt;/strong&gt;&lt;/div&gt;
&lt;div align=&quot;left&quot;&gt;
&lt;strong&gt;- 16-bit Unicode character&lt;/strong&gt;&lt;/div&gt;
&lt;div align=&quot;left&quot;&gt;
- 储存（单个）unicode字符&lt;/div&gt;
&lt;div align=&quot;left&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div align=&quot;left&quot;&gt;
&lt;strong&gt;4、decimal&lt;/strong&gt;&lt;/div&gt;
&lt;div align=&quot;left&quot;&gt;
&lt;strong&gt;- 128-bit precise decimal value&lt;/strong&gt;&lt;/div&gt;
&lt;div align=&quot;left&quot;&gt;
- 储存数值，大概29位精确度&lt;/div&gt;
&lt;div align=&quot;left&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div align=&quot;left&quot;&gt;
&lt;strong&gt;5、double&lt;/strong&gt;&lt;/div&gt;
&lt;div align=&quot;left&quot;&gt;
&lt;strong&gt;- 64-bit double-precision floating point type&lt;/strong&gt;&lt;/div&gt;
&lt;div align=&quot;left&quot;&gt;
-也是储存数值的，精度较低，范围较大&lt;/div&gt;
&lt;div align=&quot;left&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div align=&quot;left&quot;&gt;
&lt;strong&gt;6、float&lt;/strong&gt;&lt;/div&gt;
&lt;div align=&quot;left&quot;&gt;
&lt;strong&gt;- 32-bit single-precision floating point type&lt;/strong&gt;&lt;/div&gt;
&lt;div align=&quot;left&quot;&gt;
- 于double 类似，但是储存范围较小&lt;/div&gt;
&lt;div align=&quot;left&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div align=&quot;left&quot;&gt;
&lt;strong&gt;7、int&lt;/strong&gt;&lt;/div&gt;
&lt;div align=&quot;left&quot;&gt;
&lt;strong&gt;- 32-bit signed integer type&lt;/strong&gt;&lt;/div&gt;
&lt;div align=&quot;left&quot;&gt;
- 常用类型，储存-2^31 到 2^31-1 之间的值&lt;/div&gt;
&lt;div align=&quot;left&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div align=&quot;left&quot;&gt;
&lt;strong&gt;8、long&lt;/strong&gt;&lt;/div&gt;
&lt;div align=&quot;left&quot;&gt;
&lt;strong&gt;- 64-bit signed integer type&lt;/strong&gt;&lt;/div&gt;
&lt;div align=&quot;left&quot;&gt;
- 常用类型，类似int，储存范围-923,372,036,854,775,808 到 9,223,372,036,854,775,807&lt;/div&gt;
&lt;div align=&quot;left&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div align=&quot;left&quot;&gt;
&lt;strong&gt;当然还有string，它就不解释了！就是储存string嘛！&lt;/strong&gt;&lt;/div&gt;
&lt;div align=&quot;left&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div align=&quot;left&quot;&gt;
其他还有sbyte,short,uint,ulong,ushort 等等&lt;/div&gt;
&lt;div align=&quot;left&quot;&gt;
s代表&quot;signed&quot;就是能储存负数的，&quot;u&quot;就是unsigned，不能储存负数&lt;/div&gt;
&lt;div align=&quot;left&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;h1 align=&quot;center&quot;&gt;
【如何定义变量】&lt;/h1&gt;
&lt;div align=&quot;left&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div align=&quot;left&quot;&gt;
你：我把上面的表啃完了，现在要做啥？&lt;/div&gt;
&lt;div align=&quot;left&quot;&gt;
我：..我可没叫你把它全都记下来呢..&lt;/div&gt;
&lt;div align=&quot;left&quot;&gt;
现在，来看看如何定义变量——就是说如何制作“桶”&lt;/div&gt;
&lt;div align=&quot;left&quot;&gt;
我们继续用上一个教程的project file —— Show Messagebox&lt;/div&gt;
&lt;div align=&quot;left&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiKhc1o3aqMZkFgn3YtXUXzb-SqZAwGiKBbTnYP0-O_J5eQCBL6cE809lq_a5DVr0Y-Dhea6IMJCClb3SEQUhg69JZDuh3qJUX5gEs8cDagqPr8_l2QucOeHxOfXo0qUoMpXqondmEUhpA/s1600-h/image%25255B2%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; height=&quot;111&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiDFWHbP5Dtwfvl4qbLnVEvxyWF6qBBmzESYagOKz2B3GkPTuRzjGT7kz2f5ttTFbYvLiTpjmaK2NJCDDUFQfSJHoQVshRdFVC_Pkx_-W3s_ob4JiXfK6yllvOyXNYWPxsbBghNCZpqPY4/?imgmax=800&quot; style=&quot;background-image: none; border-bottom: 0px; border-left: 0px; border-right: 0px; border-top: 0px; display: inline; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; title=&quot;image&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div align=&quot;left&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div align=&quot;left&quot;&gt;
你：我要怎么样把&quot;Hello,World!&quot;换成变量？&lt;/div&gt;
&lt;div align=&quot;left&quot;&gt;
我：记得&quot;Hello,World!&quot;属于什么类型吗？&lt;/div&gt;
&lt;div align=&quot;left&quot;&gt;
你：String！&lt;/div&gt;
&lt;div align=&quot;left&quot;&gt;
就是string了，所以现在在MessageBox.Show上面输入string：&lt;/div&gt;
&lt;div align=&quot;left&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEixU1PR23oC76Q5C2K1Jq3m6L78aCDyoL3tx5nvGD0wx2mGNRdWw6baBc-lxewOOm29XZPPwmuD3TkOZl_WMBvhlYWUtBoOFgSgcQdryegnFMPtx4G8dJwnLsoNOLbAY4h1qXYRm4NP1rQ/s1600-h/image%25255B5%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; height=&quot;101&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhBfyogevORjeYF-dnLu4cyZYXuiBE-MEHVwCxYr1idwKa8GjkKNEJXJNTEOYVvDDESqvt4n0U1TVGdFBMpaLzeQxgsIcbRIhgY_8E8DWmPDnWEM4A6mPN7bQ40ukhElcA37V26ltqVyqbm/?imgmax=800&quot; style=&quot;background-image: none; border-bottom: 0px; border-left: 0px; border-right: 0px; border-top: 0px; display: inline; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; title=&quot;image&quot; width=&quot;399&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
然后string 后面就是变量的名字，就给个hello吧！&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhW1o8l3ERvQBIlZPFNLk5yYoTka48c0TnIqiDfUqhMAGSYdinfEK9hWM109CTfhSekJyEBFHvkAosj19rzMBN_8x2wwUbzZ9fZdasKvcYvrj0s3jmPtLImfSeXQdJN1nIi6yVuUzljb3lZ/s1600-h/image%25255B8%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; height=&quot;109&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEinSXBotoOBf5ozEZoj9OkTRmQ-jFCHt7k96HTVEqNWoBXqsB2vvQhN06CJ1nHQwQ8AmsUvPVD3FLQO6zZ0HpDTTftv5QElO0BcKzGE8qxYoV-fXmg6h3sSOfLLM8QfGzrrmceYzXtmv96M/?imgmax=800&quot; style=&quot;background-image: none; border-bottom: 0px; border-left: 0px; border-right: 0px; border-top: 0px; display: inline; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; title=&quot;image&quot; width=&quot;426&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;background-color: yellow;&quot;&gt;注意，C# 里面变量的名字是&lt;strong&gt;区分大小写的&lt;/strong&gt;，就是说hello 和 Hello 或者是 hEllo 还是 HEllo 都是不同的变量！&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
你创建了一个桶，有名字了，现在就是给它“倒水”——&lt;br /&gt;
给变量一个值，就得用“=”号：&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiGO3Dg4lhVTgYq2TlesR09iwYU-Fds1i3IS9NohsiPEDUAKjZDGKqYwwqnNxW5Hh3WTifbJ8vwwd_EuQngZr7vQ1zmeaeROMIe7SnX_brp2K8960QFD8xX4OS38Hv6fabf6zc8pCWj2q4/s1600-h/image%25255B11%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; height=&quot;99&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiGARBuy3_EVPQtU6B32TtchYs7TSsxTAQ1lKR5VyXlCI3B1TlbOwjxLE2Gerk4NoPr3IoJ4KMD4scofOV4pb1yHbZ8d43BIJIlW-o7_XMyymu-kqt1vL_aIJgVwfR2nk2KcUsejqo_CB4/?imgmax=800&quot; style=&quot;background-image: none; border-bottom: 0px; border-left: 0px; border-right: 0px; border-top: 0px; display: inline; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; title=&quot;image&quot; width=&quot;397&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
然后就是你要的值，这里就是&quot;Hello,World!&quot;，记得所有语句以分号;结尾——&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhQ2BREsxDsq1YafPDJ5knhqi0rpgVtm_oZ6cyHvtbVtEYo3sNY0WUjNShCeXf0el1tjGlLNoGVDRfFX6c2q5Ms_5E9t3N2qefA5TcnZZC8ORfKF2yVm9-aE5nITEyq1feGdsC_Z1XA_K4/s1600-h/image%25255B14%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; height=&quot;94&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi1REl1fpNBzDDfpHioNQE-UrABbbUGBQTGzV9NVgaUDEARahENByCvW02QcLjsbY564TNpuZ-s02jB1DOl65QylWIbtX_y_vO4O9z5mWX-kgZGU99eu9Ut9w1mo6UziWrrh8uYPurXjLA/?imgmax=800&quot; style=&quot;background-image: none; border-bottom: 0px; border-left: 0px; border-right: 0px; border-top: 0px; display: inline; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; title=&quot;image&quot; width=&quot;393&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
现在如果要在MessageBox 内调用的话，就直接输入变量的名称——&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjiISVtwfCN58h95w4Gwah19vmchXAazrnC2F7rq7nlh5b7C8r2E9wDwKVMO0nentjv_GcqK6VZwrb23Cj-G1_cDxJGjoMTkTMGOi_t5dK1yCtYW73CJVfb161ffMObQOT9PeHSjxNmFrk/s1600-h/image%25255B17%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; height=&quot;108&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjJ8-AzqdXKgYlJ7UTmZtWvx-J80fnKuMsg47Gp2GcgoQeeTJ4CAeX46znVAwR5l_sTbZhKbn1He-Kw7HyWdbSTrUD78oZVyvxKKfy62eZLLL40qWvc8PhnKQqNSK33IH51NZx7EOauEdk/?imgmax=800&quot; style=&quot;background-image: none; border-bottom: 0px; border-left: 0px; border-right: 0px; border-top: 0px; display: inline; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; title=&quot;image&quot; width=&quot;406&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
编译&amp;gt;运行&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjEOjQxlaqyAu4DqYv6cMY5s8E-F0JJzHfdiBR-XKcO9PHSIWserSDRPnrHcoA1isdwdN2gMAaRM-aOGjnccGdLzpCDqV77CBzh6KwLXS2B2jIZvtRzkMJo_cdpucP_jStH1zqZDv4HOn0/s1600-h/image%25255B20%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; height=&quot;317&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgtbtxrwBPRuhrxkhqqL1SLD-WZbwOwChL_bRxDE7ECuqCUnJBNipvH6fpfyBtJzWmrPXz6ZPd7nCPLgk389klDOP028V3V8zvRNTa8zx4UxKL4apxFj56tmVOE5EEJ5ggWFD4PpYlY_68/?imgmax=800&quot; style=&quot;background-image: none; border-bottom: 0px; border-left: 0px; border-right: 0px; border-top: 0px; display: inline; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; title=&quot;image&quot; width=&quot;280&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
你：如果我要储存一个数字呢？&lt;br /&gt;
很简单，用int 类型！&lt;br /&gt;
你兴奋的输入了：&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgUSJiNIC7JF01mm5_ye5QC7cH2MMoU9TOkMTWesv88B-zEwoSEbYmraWCLZ3TLjaXSbHXQ6JRxCb-Dtnck_XCW66w8W7y19K-xxp02hzV22jWnQXesp_V6NbZMBNCLcJjd2MKKPjdKxdd-/s1600-h/image%25255B35%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; height=&quot;97&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi7RdiRim2NVomRz-hVjjCicmT_sNTzpFTH_qYYyhF_H4rorr-trDZm6PaDwRV6AxaePF-a38MDmivdniJOtYjyFzs7qwaKOLKZvTl5YY4EDDShanbb7CSsYnrt1Z5gKcQvxRd4uJFxKeU/?imgmax=800&quot; style=&quot;background-image: none; border-bottom: 0px; border-left: 0px; border-right: 0px; border-top: 0px; display: inline; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; title=&quot;image&quot; width=&quot;398&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
你：我不喜欢波浪线啊啊啊啊啊啊！！！&lt;br /&gt;
因为age是一个int类型，但是MessageBox.Show 方法只接受string为类型的变量，你要如何转换呢？&lt;br /&gt;
用.ToString()方法(记得那两个&lt;strong&gt;括号&lt;/strong&gt;！)：&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhsF9gvNJd4axBQbQGl4NZiJb8dELQ-LfwyfZICaUrh1y2TbdvkNsiWo7i9NqmtQ63LajR35S1rG6IspIQaeOzQnZpHpAUkilyP6S7XYKR_jeTN6mya_aUeH8ZCBPF8_Sel1OJ4esepGiU/s1600-h/image%25255B38%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; height=&quot;179&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEia_fj4tf6QrpT1-xoVto-G4BJwTLJKGRasHm4M-HUic-IGVcFg-mjyW6i_7w2Vs4rp1nNE2EBsBKDYtuXXOJB9av66_uKFNxAzs0qhxUqr6b2NP8Q-f32SqbyYnCRf4J7RgauJF7Rl6pHA/?imgmax=800&quot; style=&quot;background-image: none; border-bottom: 0px; border-left: 0px; border-right: 0px; border-top: 0px; display: inline; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; title=&quot;image&quot; width=&quot;709&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;blockquote&gt;
Converts the &lt;strong&gt;numeric value &lt;/strong&gt;… to its equivalent &lt;strong&gt;string&lt;/strong&gt;&lt;/blockquote&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEifcRGl3QrQduh3CzXWELYepnMD3QDhxvPbFobvyaArpR4Tyc9TYHg_9hyphenhyphenmQmj39MhXg1HRqmKqiAMzSMw3kVxJ9ZiprhV29eYhk1J9Fo66JgC6Uo05yurpqEQb9VF_uQDKGos_Ec9FHpw/s1600-h/image%25255B41%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; height=&quot;93&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhjTGx-Ay36pS3ySeOmG1i8y0GrVYvn7dkLMjKgkKLG9zBqS3tCTewQkFehuv2OE4zciW7qWeGRT3WN09ItpIrWxvvLlmvl85khzJMljErzMydyjEqpxHAihnVcTE3lGuPCTxDoUbuoH08C/?imgmax=800&quot; style=&quot;background-image: none; border-bottom: 0px; border-left: 0px; border-right: 0px; border-top: 0px; display: inline; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; title=&quot;image&quot; width=&quot;410&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
运行！&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEieMCRPcWK3EZCVAFePKxNnBT69lXbTleHSL_eYFtGzHvwiEtwfcOf8dAPyJPz6w04gop9YJgRi9_g4CQGvO8D6_f2GOMCuDOD4Z9WQrag1-HTnPWBR7Ce9PWVH9bYq6q4uRwSiQE8elzM/s1600-h/image%25255B44%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; height=&quot;306&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiOpJgzFyNaDIL3DafcSYgMsDu9DGizIl5y_XWJ7hvYXfxuECsXV30ytOBL1tj3DQSA6HHeSfV-OlIjwjGKQdvUBP0CDDEWEWLuJxhcs5cGtuZkOPzcEkYkoGOHSaJZygvOnNbvdZiNa88/?imgmax=800&quot; style=&quot;background-image: none; border-bottom: 0px; border-left: 0px; border-right: 0px; border-top: 0px; display: inline; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; title=&quot;image&quot; width=&quot;260&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
所以现在知道如何定义变量了吧？&lt;br /&gt;
&lt;blockquote&gt;
&amp;lt;type&amp;gt; &amp;lt;name&amp;gt; = &amp;lt;value&amp;gt;;&lt;/blockquote&gt;
其实&amp;lt;value&amp;gt;也就是变量的值，大多数可以不用在定义的时候赋值：&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjx-3c5GHD52TeOxrUPWSnlwhaTM6funeUe6dAQ4VcvV9YKqZ0RyTtSUHfYj0bv3LH8GpAu7-ydUG3QOsLcBOkQ5yI-qRgY5i85K_E9zNqET4L9huU07CAyz6Oi5jtpcmikufUZTSVDSfY2/s1600-h/image%25255B32%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; height=&quot;98&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiuG1aqyayy6RQ65tLsvJ8N9OQ5qlON7TC0m5qosPPv-7eqTwLR23vT5-SNdgm-o7Dkq1Lk9ihIKW47hJevPc_YARPBsAbyA_izKUGdsadjIah_yoj8sXrD-Y-kSjPMPuFaYDnckTjSgdk/?imgmax=800&quot; style=&quot;background-image: none; border-bottom: 0px; border-left: 0px; border-right: 0px; border-top: 0px; display: inline; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; title=&quot;image&quot; width=&quot;395&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
你的hello值默认为null&lt;br /&gt;
&lt;h1 align=&quot;center&quot;&gt;
【如何更改变量值】&lt;/h1&gt;
你：如果我要更改变量的值怎么办？&lt;br /&gt;
你有两种方法——&lt;br /&gt;
1、直接修改本来的值&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjXvc9IYenkXMLAJ3rQkvMF5w7S-_rJ2CE1D-KE2NjkVxVObvb7Pf-3Bzg1Wg3jEpvOdUwgpqsdmHYHyWMXneQlSeyFkgCb-BmvEBP6XB86K-CLCUipCmV7HBxYyPmx7I-km3Lru72rfRM/s1600-h/image%25255B23%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; height=&quot;101&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhxj_jmLM6X7lltj9QteQM00WektVKEURh38SGU-I0E23LcAvKra08DV-KaWHQHVq-b_KF2kRM8OvpE6_7aB-m6GjWRZJoK8pP2V8aY6ULClum6vkYyA4FnAzjNWqdL3AT0RJEPsQ9wu_aC/?imgmax=800&quot; style=&quot;background-image: none; border-bottom: 0px; border-left: 0px; border-right: 0px; border-top: 0px; display: inline; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; title=&quot;image&quot; width=&quot;408&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
但是如果你要在程序运行的时候更改呢？&lt;br /&gt;
2、像定义变量的时候——运用“=”符号&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgvNcXVcRywQqR1ri-56c_JwV8SslxhBnmDbrCDjkGe2P3OEByciW27ME7wNtGHbLffE9iYPhp472-rIf-SwEJ32RqxoyTvj71PaZcteu0nRyJo8_reg2ZSgaem_VgXRvpbqJGZZ0zbpqA/s1600-h/image%25255B26%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; height=&quot;132&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgEE8052PG8KfBWK_bPfm2ZBiVtyPYPOEH3GUa4meU52E4nsy0Yjb2YXoR9h_SOUl39R5hIVvD8nY10Kpe1rSJWLswPtSJEYSjo-cMteu9P2r4VAPNgGWOLO2OWnYgwF-fucDKuYU-7OzU/?imgmax=800&quot; style=&quot;background-image: none; border-bottom: 0px; border-left: 0px; border-right: 0px; border-top: 0px; display: inline; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; title=&quot;image&quot; width=&quot;411&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
运行试试看：&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjvgX7oZkVWziMUnQoeTXbfEsjZjgRUam2_44PlQagotYaxjCMZEKypSw-WU6mrrOfZv2Tr2Y-beZ5Nf_G2Pu1f8Mppc6QFF0e61gTNK9agUrtYvjRFxIpS37s10ktwJuxxVS6x7qibV_IA/s1600-h/image%25255B29%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; height=&quot;292&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhSJXJHxR32ZXrQ0BrImYrlmAwFvsSPppp9Y0e4YjHq0JNWW7PAr6r9-A2IABdhneaKaS6Zusp2hflZeCd9AFauyC1jKt7F926xuwJeGLPRlF_ZtoybNQNbaDrO5nVX1i-jZ6-BmMN-YGg/?imgmax=800&quot; style=&quot;background-image: none; border-bottom: 0px; border-left: 0px; border-right: 0px; border-top: 0px; display: inline; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; title=&quot;image&quot; width=&quot;341&quot; /&gt;&lt;/a&gt;&lt;div class=&quot;blogger-post-footer&quot;&gt;&lt;script&gt;
SyntaxHighlighter.highlight();
var linkwithin_site_id = 1130633;
$(&#39;#toTop&#39;).remove();
$(&#39;body&#39;).append(&#39;&lt;div id=&quot;toTop&quot; onclick=&quot;$(\&#39;html,body\&#39;).stop().animate({\&#39;scrollTop\&#39;: 0})&quot;&gt;Top&lt;/div&gt;&#39;);
$(window).on(&#39;scroll&#39;,function(){
if ($(this).scrollTop())
{
$(&#39;#toTop&#39;).fadeIn(&#39;fast&#39;);
}
else
{
$(&#39;#toTop&#39;).fadeOut(&#39;fast&#39;);
}
});
&lt;/script&gt;
&lt;script src=&quot;http://www.linkwithin.com/widget.js&quot;&gt;&lt;/script&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://garyngzhongbo.blogspot.com/feeds/5030252061419731370/comments/default' title='博文评论'/><link rel='replies' type='text/html' href='http://garyngzhongbo.blogspot.com/2013/11/c-6.html#comment-form' title='0 条评论'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5319618319979683940/posts/default/5030252061419731370'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5319618319979683940/posts/default/5030252061419731370'/><link rel='alternate' type='text/html' href='http://garyngzhongbo.blogspot.com/2013/11/c-6.html' title='[教程][C#] 新手入门教程#6——初识变量、数据类型'/><author><name>Gary Ng</name><uri>http://www.blogger.com/profile/00014057672539539340</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiDFWHbP5Dtwfvl4qbLnVEvxyWF6qBBmzESYagOKz2B3GkPTuRzjGT7kz2f5ttTFbYvLiTpjmaK2NJCDDUFQfSJHoQVshRdFVC_Pkx_-W3s_ob4JiXfK6yllvOyXNYWPxsbBghNCZpqPY4/s72-c?imgmax=800" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5319618319979683940.post-9207786773555061726</id><published>2013-11-19T19:15:00.001+08:00</published><updated>2013-11-19T19:15:36.376+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="C#"/><category scheme="http://www.blogger.com/atom/ns#" term="入门"/><category scheme="http://www.blogger.com/atom/ns#" term="原创"/><category scheme="http://www.blogger.com/atom/ns#" term="教程"/><category scheme="http://www.blogger.com/atom/ns#" term="新手"/><title type='text'>[教程][C#] 新手入门教程#5——开始写代码：MessageBox</title><content type='html'>现在进入灰常好玩的地方——我们开始写代码！（这让我想起——【&lt;a href=&quot;http://garyngzhongbo.blogspot.com/2011/12/blog-post.html&quot; target=&quot;_blank&quot;&gt;题外话】一首诗歌-写代码&lt;/a&gt;）&lt;br /&gt;
&lt;br /&gt;
&lt;h1 align=&quot;center&quot;&gt;【如何显示代码编辑器】&lt;/h1&gt;如果你忘了——点击form，按下F7&lt;br /&gt;
或者是右键点击form &amp;gt; 点击View Code&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjwOYG-Fs5sshLuAQYMPdmgvL3wS5eY4yWU5hv2tjD4yvH6yvD-_St3PshIyPlQpI-PAUq6Z2bgJB4aWHJ4Y7ash337GYig2UFTth481v4xT8gflBg7cgKUjuGDYlOaFmpb4NIs52X_xXM/s1600-h/image8.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; height=&quot;166&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgCpR1UjyjlIZoChNrBy75635F5u3a-Ozl5KJTBnYryXJrdWxh5v1fdolDMK4Etu88EDBHX3Y9eqnZnIDIFlj_nGgTi-6RjQ33vLydIPScgoQrfJIBSyV1EpZAmyAvlF1i184RKdq3gY8wU/?imgmax=800&quot; style=&quot;background-image: none; border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; title=&quot;image&quot; width=&quot;314&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
就会有这个了：&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgv30iXwWc7ol1PJYIN5fHBxc3vGS5oYt4l28atuFuPfcwCj5R70-ZE9iQb3lglqetkGPYyXVArA_T8xVcqVCpWNST2WGfw6K9jlshMwXdAtSenElsr2e3GwL_yMFpwkv7OcThrWL-_QhC2/s1600-h/image5.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; height=&quot;448&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjqq2RwCviM2ISEZI2vMTsFZ8WuiCjqm_N8hcsemqyoYEuEWBk0DxgtkiITdEA3RqLw-4FYOWDHinUfYYaNZkt8jykSsTDzqlhKuNPeritu7vEnXjXWxvxlqC56LXE-jAy2O-9P_9bP5ZY/?imgmax=800&quot; style=&quot;background-image: none; border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; title=&quot;image&quot; width=&quot;544&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;h1 align=&quot;center&quot;&gt;【基本设置】&lt;/h1&gt;&lt;div align=&quot;left&quot;&gt;先不谈代码，往form添加一个新的button，然后更改text 为 &quot;Click Me!&quot; &lt;/div&gt;&lt;div align=&quot;left&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjO3ota6QwC44fEsUyo-exSQXF8utR1JnRvOHpMknedzo4P1OlNk3h2ElvlF_F-z5anmfs_XnULth6j3LVraokOsyi6zRaK1jIU7qjFq1FKf3MpkZE1y1wB4_cMls_mlr45pxyR4hlEN3o/s1600-h/image11.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; height=&quot;359&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiY77zhQ_X9iODUdLjIQtGMF3pgEWnnRFAdUz__j0T0JGmAtrE5kzXxtM2QfyStTv8lxO8o6WzXHlHXqg7gUk0sGaKWnffuQRVQ3f-ZVvQO6nxg752_SQzBFq243FobxkugzZkzw8NdT1vu/?imgmax=800&quot; style=&quot;background-image: none; border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; title=&quot;image&quot; width=&quot;269&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;h1 align=&quot;center&quot;&gt;【初探Function】&lt;/h1&gt;&lt;div align=&quot;left&quot;&gt;双击button，你会看到在原本的代码上加了新的代码：&lt;/div&gt;&lt;div align=&quot;left&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgqS9HKlUKjcpyNPXCX-dPjsqvREgss75sjk3YyPS-b0a7Euq7Jmaw18VNaeFKzGQRPj7ZN7OK20A91kZ52QvWEi27Sjepr0AThyZDmeIoxnbz2YJyLZsSzzNJEA4AyhtssNbwuvL6vpDw/s1600-h/image%25255B2%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; height=&quot;443&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh-LjwpmykWCAHXwCv-Kvs4rLHbqnDfnNTzRR6itBe5u4tIM2gCR_Mdqus2YGExOxTgi72VfXO3ZyA7sJe-xNKr178VZjbSS1VwowuYdFKZCVWqJyBLNPtT0Ze3mJnnlxcXMAuD_RnYqp8/?imgmax=800&quot; style=&quot;background-image: none; border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; title=&quot;image&quot; width=&quot;597&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;pre&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre&gt;&lt;span style=&quot;font-family: Calibri;&quot;&gt;这就是一个标准的function （其实是个event的function，先别管这些）&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style=&quot;font-family: Calibri;&quot;&gt;private、void 等等这些东西先别管，免得混淆了（你只要知道这是一个function就就对了）&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style=&quot;font-family: Calibri;&quot;&gt;我们来看看button1_click，很明显吧？&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style=&quot;font-family: Calibri;&quot;&gt;就是button1 被click 的时候，这个function就会被运行，至于括弧里面的是参数&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style=&quot;font-family: Calibri;&quot;&gt;运行？运行什么？就是运行在花括号内{}的代码！&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style=&quot;font-family: Calibri;&quot;&gt;&lt;/span&gt;&amp;nbsp;&lt;/pre&gt;&lt;br /&gt;
&lt;h1 align=&quot;center&quot;&gt;【初探Intellisense】&lt;/h1&gt;&lt;br /&gt;
&lt;div align=&quot;left&quot;&gt;消息框的英文是啥？&lt;/div&gt;&lt;br /&gt;
&lt;div align=&quot;left&quot;&gt;Message Box！ 所以要显示message box 就必须呼叫message box！&lt;/div&gt;&lt;br /&gt;
&lt;div align=&quot;left&quot;&gt;于是兴致勃勃的打下message box&lt;/div&gt;&lt;br /&gt;
&lt;div align=&quot;left&quot;&gt;咦？等等，VS跳出来的这东西是啥？&lt;/div&gt;&lt;br /&gt;
&lt;div align=&quot;left&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh4O_MPL9qGXi7rPmHqg-WJ0jBlktoUBLXGHphppOpA35iyR_iqxj_O4yYO1IkM4UyMYCkqYZeUEJePV8DsndTRLeQ7knTeD6ZdJ_04wYA4W3VnC0TeCTWhmCaWr99Md-G48wA06b2GFwc/s1600-h/image%25255B5%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; height=&quot;245&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg2DKrY7Qr4zJU0G-yFnBuiWHYF94hyX3T0MDlVv8cTOMw6tkC16wFlv-9JwZz6qo8h0h2sQnP_Uuchz-SAqha1F74B6UBuPSnnyg-F_X4ACnjTtK-6qCjNNX1uxaOB9qoWStkMxVMIxjg/?imgmax=800&quot; style=&quot;background-image: none; border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; title=&quot;image&quot; width=&quot;416&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
这就是Intellisense，华文叫啥？我不知道！&lt;br /&gt;
&lt;br /&gt;
总之它是auto-complete的好帮手&lt;br /&gt;
&lt;br /&gt;
看到VS帮你focus在 MessageBox上了么？直接按下Enter键，它就会帮你打好了！（快吧！）&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgr5Kos-keagKCFOIyKMxHk1baTrvqmY98PTOYq2fBlm9Q8nsm7NPkcn2Ntg9nY0iFCTquVP69e8c9tEkuqL6czFd6fPU7dnvzKWrLslehelD98p8r4X8WT3Nddo4jlvgc8PZLCDWJ2Vfs/s1600-h/image%25255B8%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; height=&quot;158&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgZ5ojskponS0hB-8PgRJypiCjHefj91lsjK3Nlv4MHQQ-jIE1m9vn9JBunRb3gcU-oASfu_rmR8QJP5B2QFi1_NM33DSU1gLoXbN2gGuqkAwLzybKWPIsHLzUK2qmYVrFapYXTtkZMUO8/?imgmax=800&quot; style=&quot;background-image: none; border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; title=&quot;image&quot; width=&quot;477&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;h1 align=&quot;center&quot;&gt;【显示MessageBox】&lt;/h1&gt;&lt;br /&gt;
OK，现在我们有MessageBox了，要咋才能跳出一个框框？&lt;br /&gt;
&lt;br /&gt;
我：显示的英文叫啥？&lt;br /&gt;
&lt;br /&gt;
你：Show！&lt;br /&gt;
&lt;br /&gt;
我：所以显示MessageBox叫啥？&lt;br /&gt;
&lt;br /&gt;
你：Show MessageBox！&lt;br /&gt;
&lt;br /&gt;
我：我汗！&lt;br /&gt;
&lt;br /&gt;
好啦好啦，对了差不对一半了&lt;br /&gt;
&lt;br /&gt;
正确的是MessageBox.Show，因为要show的是MessageBox ，MessageBox为主，show为副，所以就MessageBox.Show啦！&lt;br /&gt;
&lt;br /&gt;
看到了没？可爱的Intellisense又出来了，猛打enter！&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhGmZK1KJaMxRE2PclTH8NGpZrYEc-88DOHNDk4IeRDkDgMDyBc2G8Hozx9MIYG5jZXC5DrPLrorQIZCbKPHkUL7So6bZvV_RcxkbAABgm-jurvzWoZm5UEMvo4ZTlpEK_zY2L2p2KmWIrJ/s1600-h/image%25255B11%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; height=&quot;128&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiYimqVWbe488NsGkhYaHLctJEYhMLFNG4_jwFbgBhlOzaf8nAgMDkyaV1vumT1sotfe2ABzp6gsc3xqG77SV81sX8FsqSW2_zl1BxaZSPMxEq4RJRa3tbgolYj7cJ3wZSqF06z_aNnsT8A/?imgmax=800&quot; style=&quot;background-image: none; border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; title=&quot;image&quot; width=&quot;270&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
你：等等！我要显示的字串放哪里啊？&lt;br /&gt;
&lt;br /&gt;
恩..这问题问得好！&lt;br /&gt;
&lt;br /&gt;
之前已经打了MessageBox.Show对吧：&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhAdLqDXGdiT3naKWtf1KwujFcyIfAOQVlcR-lTIBvjkTqV29yRpKbAfWhGlKOVm1gBqEsM8ojKe3AWtmH4pq1E4znJRq2mr62d_-EaIlw1v9SwEfymgN2CxOn_rPcRrAP5jt5zWMQfXw8/s1600-h/image%25255B14%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; height=&quot;107&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjkQUTZTNWa6ach2Jz0dyfYbyK5EtPcqY3pGRBl2xQ1r6S4lsULlG56ZbBm0pzudqW6toqnNQFDSN0PiqLD2_1h_wo-3Ifvo9hZqT2Lj-n_8iG-W0FycAWO_w6G9L0bjv93rTaZUSmjTY0/?imgmax=800&quot; style=&quot;background-image: none; border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; title=&quot;image&quot; width=&quot;337&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
就如function的括弧一样，在打下一个括弧&lt;br /&gt;
&lt;br /&gt;
然后Intellisense又出来了！&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh3MBEVDw6XHv01eRvoxm9xteOk01EWMH1cBL62b125rcJGD-13ARTPXOjW2vJkSeNmPt73WTDEUni1V2eRCIoX3G_8c8bQ7ae4WEenzonYtcMir5orCxRQgGrd573emhg2vqsJip4K_Vfr/s1600-h/image%25255B17%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; height=&quot;92&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhbeLuAIFiotN0x2jj95aYN6q3opOpICE6U1PjPBkfOXUIg8vntO-VLAAHxYn7ePjI4mxtXXp_fSkQBLMwYJthxLfmgCwbgjS94fvgN4KPVwdFG7GSVbTWm_uztugd76vI5xw6DlcBXJzw/?imgmax=800&quot; style=&quot;background-image: none; border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; title=&quot;image&quot; width=&quot;450&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
System.Windows.Forms.DialogResult MessageBox.Show(string text)&lt;br /&gt;
&lt;br /&gt;
string text是啥？&lt;br /&gt;
&lt;br /&gt;
就是一个为类型为string（顾名思义就是字串啦！）的变量text！&lt;br /&gt;
&lt;br /&gt;
你：所以呢？&lt;br /&gt;
&lt;br /&gt;
我：汗！那么明显了看不出来么..&lt;br /&gt;
&lt;br /&gt;
就是把要显示的字串放在括弧之间啦！&lt;br /&gt;
&lt;br /&gt;
然后你又兴致勃勃地打入MessageBox.Show(Hello,World!)&lt;br /&gt;
&lt;br /&gt;
接着VS就帮你画了个很漂亮的波浪线给你：&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgrTtFp0rMd6WuWJGtsZ4hFQfhAsgsk-sdCRy5EO7mj9dXNgSjxUCrnYwn8kpr7-aG7_fNW-a0b5Uvve0tckN7NSHXwHvDqy2zEmqHwXLZ0zZAfnrfwbjvXjSxMaJasKf0COvcdSuRtnZzW/s1600-h/image%25255B20%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; height=&quot;101&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgS7MVF_o_GAi6ZFuFxbMmLxcA8DVIHQ76mvLtjcP8YtZ6F9hpjVNSTyX7xQU0xQG0FSHl6Pz1Czpbdfl6FMIvyKsh1IWPhx_K9_WGzGMOsa1lRx0p5BiN6nTqXBSN9K_Mh31nObdENnOk/?imgmax=800&quot; style=&quot;background-image: none; border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; title=&quot;image&quot; width=&quot;413&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
你：这是神马状况？是神马状况？你说啊你说啊！&lt;br /&gt;
&lt;br /&gt;
为什么会有红色波浪线？因为VS把Hello,World!当成是一个代码了，然后它很努力的往他的脑袋搜索Hello,World!代表着什么，N秒后发现到脑袋内竟然没有这个东东，于是弱弱的画了波浪线给你（很像老师批改考卷吧？）&lt;br /&gt;
&lt;br /&gt;
你：说重点！&lt;br /&gt;
&lt;br /&gt;
好好好，记住了：所有的非代码（就是不要VS往脑里搜的，这里是指字串，string），都要加上开关引号——&quot;&quot;（如果你不知道开关引号是啥：就是在Enter旁边的那个按键xD）&lt;br /&gt;
&lt;br /&gt;
于是你打下了MessageBox.Show(“Hello,World!”)&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhHXlh7wLVZyow0ePzia_E6w6tY6fZkt4NZ-wZYaaKgug2yY33EbGiK9GNM4xfwKsJrzloMzz72xhVnH2UMZPpjsWPcFiwVXOEDq_4AogYXvFjV8m1XZHu56jtUopV-E0HAQaims3LvSiBn/s1600-h/image%25255B23%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; height=&quot;102&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjxWlLG353ZbI-3JAzCuHOt75Z0N3Paw2KgE-fe2fia7UqK4HAXtns25PKrgaJ3wIlZ4KiwyIJhqFazSDmIIQJuX7EWHBpeK-iri4VJd3_W5gMCtTz5XFe2JSFHFYCaSUBP3XDuFW1vd2w/?imgmax=800&quot; style=&quot;background-image: none; border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; title=&quot;image&quot; width=&quot;416&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
你：这又是神马情况？为啥还有波浪的！&lt;br /&gt;
&lt;br /&gt;
我：为什么会有波浪线？因为VS..&lt;br /&gt;
&lt;br /&gt;
你：说重点！&lt;br /&gt;
&lt;br /&gt;
记住了：所有的代码（当然有一些除外），末端要加上一个分号; （如果你又不知道分号是啥，就是那个在Enter的旁边的旁边那个按键xDD）&lt;br /&gt;
&lt;br /&gt;
因为你要让VS知道该代码在那一行停下，就是我们的句号那样 &quot;。&quot;&lt;br /&gt;
&lt;br /&gt;
所以正确的代码就是：&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh3EjtmZrlyBJUSv0KN00x8VNNvOYRVc6zk2ghIMqdjs6dOpUiEUqy6dNQ_yd1XzuOPBRI0fWES0kX2RrweEiC9sncqiq7n9_tBxrFDDMN8k0TD83eRExugi9s-nyKEhkq_XgECXaCLXpI/s1600-h/image%25255B26%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; height=&quot;97&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEicphdzATr_3-W2Wf_3RH2aSR5RQB8oLZXXxT3GAr84co15d9GGkQEdlZfJxlqhLOs9sOd3xA4Ukqp3j9hkhSttU28711lp4dxV1bBb6RiNfakl6P-iC67NBcyuZ5Xq9io-GSDrNepXbDfQ/?imgmax=800&quot; style=&quot;background-image: none; border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; title=&quot;image&quot; width=&quot;414&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
你：然后呢？&lt;br /&gt;
&lt;br /&gt;
我：按下那个代表着成功的按键！&lt;br /&gt;
&lt;br /&gt;
你：啥？&lt;br /&gt;
&lt;br /&gt;
就是debug键啦——F5或者是上方的&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgzHsbBqkBajpUDZg24dSqPOud1drD2T0bDXkJuyyhJTJghnw9cIN0cJhTpCqeq9r4Rgs7QdBByveZaCI5eOp40B5dSVCrQAAQA__9LGIPZFDq7sUbBjeOj5SBN96TW_6WkcVdXmR63osU/s1600-h/image%25255B29%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; height=&quot;21&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh0iNGLw0RF86vn-OR9GQXStfx0gP4hnBE8zuYn9iOo22UPF-XDCAlTN2VhMOOCqtXmUVBhPEoHo2hSXPeNAkALezUfaGeky177rEOvxX-IIMga2aiNE03qovYvGB6S_4-FNsIO9ifK5sc/?imgmax=800&quot; style=&quot;background-image: none; border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; title=&quot;image&quot; width=&quot;19&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgXw1gWlxEO_3aLe2XDCjYtYG9D-Kmc_RHfaJYZAYQSL9a4jhq_lZwSaEjbiKD4hkWFztx9NbJYRdP_pVDB0WkXrj1gV750sPHw0eQ_IboPprvjhPy7WsEmBB6JK3vgO-qoVS4RX22RvVk/s1600-h/image%25255B32%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; height=&quot;287&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh0R7Md0tbswwnOyB53MSCFX6QsGlJvSytVKptq13CgfmXS0DrGGc-sBjLz2BGzPF6ccLZyJzeWnfIV54gbQ3_MI1pw96XmBan7J66jxl2HRGuqc2ZaHD5vaz-7ZvwvS_NNYMeLUscQX7g/?imgmax=800&quot; style=&quot;background-image: none; border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; title=&quot;image&quot; width=&quot;444&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
然后就会看到这个：&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgwrgQvRgsbPjwxUYuR8RwDnWd-5_UNJW2neM3lw1PDIQf5NoAwuo8LjbxZCjEtqXyg6vQUEGvYDi-7SnTR-KK0ZMg5_2-6HcboF1_5V3JMFBL4dX-sf5I7JRQdfb_vtjNqpTvAsHXiG1pu/s1600-h/image%25255B35%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; height=&quot;322&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiatdx2xWu8eIMCI9ALwEbnKqa7_GxQQc5EbsJivC7DO1PF06V_X8IKRBQKJaq0ks6kws90yEQ_idWB03rO0JcFlnEyCpdFH5i3DyJtmrydVolPmdt-vBvpMUGgUZ4DydUJ3hL18l4mKrwu/?imgmax=800&quot; style=&quot;background-image: none; border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; title=&quot;image&quot; width=&quot;237&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
看到button了么？&lt;br /&gt;
&lt;br /&gt;
用尽全力点下他！&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjBF9mzrI66BBuKbsPxu_9JVoDq2lE2K6TbpXnM-Jw_xN6Q-QZnYIwEa3Cskpv2CgWCoAFvdHZbwxGc1HID1h5hgmeIp6Xe8BI2lKXNPJWDfkDfVM3KZlRyPvMka1CptTcQ8zwIBKH9iQs/s1600-h/image%25255B38%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; height=&quot;346&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhXKRk6rzCQHOp_TYwuj5ewCkB9UvGRc6Q817WpaXPtZBGwUmPkHcAAzNLOC7RVN9wbfJiP_uTdwZLiTccuN__mk8lSfMcW27EsVhPNUVzlcUppISGW_K0PcRd2q6DIsuWDmRqnPZFkr8Ea/?imgmax=800&quot; style=&quot;background-image: none; border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; title=&quot;image&quot; width=&quot;259&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
你成功了！&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;h2&gt;【更换标题】&lt;/h2&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
你：为啥没有标题的？&lt;br /&gt;
&lt;br /&gt;
恩..good question!&lt;br /&gt;
&lt;br /&gt;
现在点击&quot;Hello,World!&quot;后面（括号前面），然后输入一个逗号,&lt;br /&gt;
&lt;br /&gt;
然后救世主出来了：&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEisVH9j9BZjV-mxli3HhwFjt0AghwBvF6eP6_PqPVRho4g70NRdS_3q7rdMeGFv4rpc4W99DMrGLU2769A4d7HtRE8j-0PH-Cwwm9sgoMZ18tPYlj3ozJ7Kj58sZIYndHC30f2e36jqfcsL/s1600-h/image%25255B41%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; height=&quot;98&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi0aeRG27edA62C-L2XieUT5CrhWP08QY2LWQWrNjznncUshC5RaAwsQFkKYgEKSmCR-GTeIR0QvRI5gY2L8AyruHq3X1foD79xopnTWIvY01vlB-xYjzexNaocNeV1vHGVfxmeVsQL22XF/?imgmax=800&quot; style=&quot;background-image: none; border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; title=&quot;image&quot; width=&quot;568&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
看到旁边的&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj2n81as7QVUMkhvDlzczj0D64ojWDXIiFqriQd08UxKSFmuOb55KNghh71wu15rwYshxtcgc30I0-PAxQmodbDK0iyAcc_Yd6puccterpwMob1meZP40MQRqZ72Yh-zvCvex2GpQuLA2I/s1600-h/image%25255B44%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; height=&quot;28&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgdRj_yme8xtjQkFlLZBKQZpJ8R8rMwUFBiyB5oyWvZNd8dFv2OGUbo-6CWBodccb2Zhsbd1ys-j-WgfjVuxJ5kMo0_hxm7wZ0_BtmNRKC06-ZQVuKQD14PkMOjFrnuDepABhRZ90R7N4Q/?imgmax=800&quot; style=&quot;background-image: none; border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; title=&quot;image&quot; width=&quot;80&quot; /&gt;&lt;/a&gt;么？&lt;br /&gt;
&lt;br /&gt;
现在按“下”键（不是下x贱…，是那个方向键），一直到你看到这个：&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiYA8EIBNV4oeMMj6Odpvzn7WZ_RSZ9pH53vUqTsL1ObKdnhCvMIAlrl0JbUpWE1FEcL4dx9-7fi-DFH7acQAK770SIAP9xWcdHzqX5Ue8eNeNhf4TVq0UeRtZV7kEjnvGoqXIfoMILBFV_/s1600-h/image%25255B47%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; height=&quot;98&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiAS-BIVrGxXFwsf_NtT4QmbgqmAUEaV1-crI215QO11Ytwwk56il8-OSPWf2LSXP8tQJcjdHL_lrwyCLYaB5S7wyYLOD3ibAZLIqjDs8vSVdfluI52XdZWVEZvHG2sSk5EYEEYFiZIPfI/?imgmax=800&quot; style=&quot;background-image: none; border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; title=&quot;image&quot; width=&quot;529&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
caption是啥？标题！&lt;br /&gt;
&lt;br /&gt;
然后..你懂的：&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjszpx_Ec1av28oADXQkqvETL7TjWJY8Al0TJzhlth5PsLAQN3-fAxs5ue-v2YYtau_HfQILdewcMJyKL9koC-jraVERjcpBxmyVui0R9NnBopcPqghJVMOx5Wd7V-7ajYaCksk-B_eBDGR/s1600-h/image%25255B50%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; height=&quot;99&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj5g6PjlNzs3l-yxB1WO60pg-K8WN-3Z_V5uNiZGjJTGM7IYOTdA8PleVptQpjl858xAD6G8722tuimneYHg8WCHruUPiqu-Ce5B2oa7Zf02hlLPqkxP-E9iUekpphXBd8eS3dMTypksTAd/?imgmax=800&quot; style=&quot;background-image: none; border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; title=&quot;image&quot; width=&quot;412&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
然后编译，点击button：&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiuJDggFXnLlZ6PebZFEXimOVBtsYPVAVRLWjiOBpESqHsP6cPIA3adnR9q0aj7mk3Gknj7D9ZYpMT5ADkK_ojr5td4VL8SnpT1fXTvNHDoy5fRa1TMqiLa9eBD3M7tX8tkY3lZKMNUEKQ/s1600-h/image%25255B53%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; height=&quot;426&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjRHqwpui1gfcTm61H6pRHRBU8HL2wN144N1TVvi64Om2SpVb2TKpDv8Vf2OH3zL13kR2E3xkTvz6XhEc1lRFtuG96L0k7BIdBt2E1pKX4G434D-rh9oiuukg8dm_v19oFYM9tHGdtLx7w/?imgmax=800&quot; style=&quot;background-image: none; border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; title=&quot;image&quot; width=&quot;260&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
有木有觉得很有成就感？&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;h2&gt;【更换按钮】&lt;/h2&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
你：我可以换掉那个OK按钮么？能不能放&quot;Hello,World!&quot;？&lt;br /&gt;
&lt;br /&gt;
我：..你怎么发现了 不！！&lt;br /&gt;
&lt;br /&gt;
是不是MessageBox的OK按钮很单调、无聊？按钮是可以改的，.net 给你了一堆option让你更改MessageBox显示的按钮，至于更换成&quot;Hello,World!&quot;的话..对不起，暂时没有 xD&lt;br /&gt;
&lt;br /&gt;
在加个逗号，按下N次下键后，你会看到这个：&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh4EqZnqh74x0hWYFShsnw_FIFT9RXjwsNWG5G_9SzCyItCGGPoc6hiKWOf0PQW6qswzmc6LOcTO-UjPypgpSGbJxtl0nZLZY3NUOxu17cVKNsPen0oGmRju90MnKcW9YF3dr1wJZ5CPCc/s1600-h/image%25255B3%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; height=&quot;125&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhWEbPAGUlabxPme6F_wCg02q_fTuoyOvg-RDbbf84VOENmmI3vQgOXDgtZAo-76N8PIe3FKP365l3pG3Oca-bRRsFFwCt-XtyoHSuK30WA8w7BSTzRWo9GXx2xWKDpgKWZm2rYMcdx4ZQi/?imgmax=800&quot; style=&quot;background-image: none; border-bottom: 0px; border-left: 0px; border-right: 0px; border-top: 0px; display: inline; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; title=&quot;image&quot; width=&quot;779&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
你：MessageBoxButtons是来的？&lt;br /&gt;
&lt;br /&gt;
MessageBoxButtons 是一个enum，至于enum是啥..恩..现在不说先xD&lt;br /&gt;
&lt;br /&gt;
只要输入 MessageBoxButtons然后加上一个 .&amp;nbsp; 就会看到N个种类：&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgIPmElE1oXvfCzG8_fDkT2sgeuxSUhO3bKhq9HwcGA0FZH3PuMZAxR14kmNPgXjLgdJbyqK6I1vf6joWpKADMolwXmk9lelmFrdpqatxUXxKnfBZb-1Y1U7RuVoeWPpHHOmF3xAZjDWesX/s1600-h/image%25255B6%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; height=&quot;191&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgv1IJ4TmKkxro2ijfEVAzL8azzfL15T7om3M-GNicT5yg1GfdzO_tVBHEcMk3OzFW1Lg-PDinX-psztb6CqeCk4wf5WPlUiAqka3zAdYWaKPwb22-DhkBm07Ad6hDQn_NFeRgmtXB0GCY/?imgmax=800&quot; style=&quot;background-image: none; border-bottom: 0px; border-left: 0px; border-right: 0px; border-top: 0px; display: inline; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; title=&quot;image&quot; width=&quot;595&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
看到了没？&lt;br /&gt;
&lt;br /&gt;
有AbortRetryIgnore,OK,OKCancel,RetryCancel,YesNo,YesNoCancel&lt;br /&gt;
&lt;br /&gt;
比如说OK，MessageBox上面就只是显示OK&lt;br /&gt;
&lt;br /&gt;
YesNo呢，就是Yes 和 No 咯！&lt;br /&gt;
&lt;br /&gt;
咱们试试YesNo看看：&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh0ctDxu-as9S_kwQSmTUpmOoz21G2TyxkzkvO26FZ1rmFaMiQXvNReuXMwIlFnfTKDKA1xMuT207iQtBnnm-AiCP0J4SbZxGCEXejT7_bDHAFGMneJ-bHuolXBthIlO4lUo-KQyL5ms3T3/s1600-h/image%25255B9%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; height=&quot;90&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhH93z2crINtXZs4hbqV9BQX3kXpxKi7ReovSpZdASHvSi5VZwirxJTtY7ENmKKSof6RaHaMULQoJVdqO-zG_BGmeq-0ZlCIyKZ6DBZ-TqK9xE6sdoznZCk0o30LtqwD1VzALYFd0mYlRWr/?imgmax=800&quot; style=&quot;background-image: none; border-bottom: 0px; border-left: 0px; border-right: 0px; border-top: 0px; display: inline; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; title=&quot;image&quot; width=&quot;532&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
然后编译、运行：&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgsotwgcUCeiIJaLM0B1vCQe3_M8rUW9Ma1mqfTPJyO-c9p1SRgJWGh3Ys70QHosw6fxjkaCMLGejf-KitTNjfEB77-rGivgeRe3So7H2_R9gR4jcb6lBPgjKdxuJsoD1I4E94KvHDC7888/s1600-h/image%25255B12%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; height=&quot;420&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi3yqlBvT6syZyLJRD0fx77R79hVybPesa5cXjl1_o33uJ_73DUZrZlyh4vRkLS9yUIJH43AYpv2jmcFlIumy7zGpAUIdgZX37HEL6ORX9twitu1z9nqC5kabS4U00OTJhiwO57zWbAHac/?imgmax=800&quot; style=&quot;background-image: none; border-bottom: 0px; border-left: 0px; border-right: 0px; border-top: 0px; display: inline; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; title=&quot;image&quot; width=&quot;292&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
你佩服自己么？&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;h2&gt;【更换Form标题】&lt;/h2&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
你：在弱弱问一个：能不能更换那个Form的标题啊？我不要Form1..&lt;br /&gt;
&lt;br /&gt;
我：Properties!Properties!&lt;br /&gt;
&lt;br /&gt;
点击Form 找到Text 属性！更改！（激动中）&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjr2oTNgb9E5gKwzG4Nd052VyP6XOQJvHU9R7TWQy2oSJmV_rkZ_rI6p3ZPx1h3a6TUrQGgIKrLALRl3GigdlLEC7T3HwZxjkR5PnMs9MiANk5p6wmDLNCDRRcEvwtXb89_q3WdgA7Dwso/s1600-h/image%25255B15%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgTe13VryDkg-PZt-aRtHXetZwjxmEiIKW7NIyiqGzlPcv-A0XYzVtvE6khVWOowOc9tvoOjL8_FyDg-HNV60l-yy0nWqy958Fk_XrJpmkiw3k_QVlHw8htxE2BQn8lbKud4hC3EIbChCu0/?imgmax=800&quot; style=&quot;background-image: none; border: 0px; display: inline; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; title=&quot;image&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
好了..MessageBox教到此.. 再见！&lt;div class=&quot;blogger-post-footer&quot;&gt;&lt;script&gt;
SyntaxHighlighter.highlight();
var linkwithin_site_id = 1130633;
$(&#39;#toTop&#39;).remove();
$(&#39;body&#39;).append(&#39;&lt;div id=&quot;toTop&quot; onclick=&quot;$(\&#39;html,body\&#39;).stop().animate({\&#39;scrollTop\&#39;: 0})&quot;&gt;Top&lt;/div&gt;&#39;);
$(window).on(&#39;scroll&#39;,function(){
if ($(this).scrollTop())
{
$(&#39;#toTop&#39;).fadeIn(&#39;fast&#39;);
}
else
{
$(&#39;#toTop&#39;).fadeOut(&#39;fast&#39;);
}
});
&lt;/script&gt;
&lt;script src=&quot;http://www.linkwithin.com/widget.js&quot;&gt;&lt;/script&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://garyngzhongbo.blogspot.com/feeds/9207786773555061726/comments/default' title='博文评论'/><link rel='replies' type='text/html' href='http://garyngzhongbo.blogspot.com/2013/11/c-5messagebox.html#comment-form' title='4 条评论'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5319618319979683940/posts/default/9207786773555061726'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5319618319979683940/posts/default/9207786773555061726'/><link rel='alternate' type='text/html' href='http://garyngzhongbo.blogspot.com/2013/11/c-5messagebox.html' title='[教程][C#] 新手入门教程#5——开始写代码：MessageBox'/><author><name>Gary Ng</name><uri>http://www.blogger.com/profile/00014057672539539340</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgCpR1UjyjlIZoChNrBy75635F5u3a-Ozl5KJTBnYryXJrdWxh5v1fdolDMK4Etu88EDBHX3Y9eqnZnIDIFlj_nGgTi-6RjQ33vLydIPScgoQrfJIBSyV1EpZAmyAvlF1i184RKdq3gY8wU/s72-c?imgmax=800" height="72" width="72"/><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5319618319979683940.post-4532036808092495286</id><published>2013-11-18T20:40:00.001+08:00</published><updated>2013-11-18T20:40:15.694+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="C#"/><category scheme="http://www.blogger.com/atom/ns#" term="入门"/><category scheme="http://www.blogger.com/atom/ns#" term="原创"/><category scheme="http://www.blogger.com/atom/ns#" term="教程"/><category scheme="http://www.blogger.com/atom/ns#" term="新手"/><title type='text'>[教程][C#] 新手入门教程#4——初识Form Designer、更改Properties、更改Form大小</title><content type='html'>&lt;h1 align=&quot;center&quot;&gt;
【Form Designer是啥？】&lt;/h1&gt;
&lt;div align=&quot;left&quot;&gt;
首先打开VS，创建一个新的Solution：&lt;/div&gt;
&lt;div align=&quot;left&quot;&gt;
默认看到的窗口就是这个：&lt;/div&gt;
&lt;div align=&quot;left&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiQhk9l53sEP-i8cAgg4plmyPMx5T-1X4SgB_BAmGb6GN091Micov5Yca9B7UtmackZrdKjLSX9Uc3SkyfZPu6lO20NfkyNCHPwoasL3l6edJHlv4ZkT6Jn9evatyNOrNIoT019X9-5pQ6g/s1600-h/image%25255B2%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; height=&quot;645&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhsZBG4vlRwROuYGm-g5CtogxsqNYla9JcROFqAN2jkTVRF22eQwPOGuRRZnls0d6hlwlP5vZHPJFmQTdAX1REVuhomcl1YvquqkI9BFQJvkyw5KkpYy_43HC2Zv7e_yUvXjWc7n9F0nZFZ/?imgmax=800&quot; style=&quot;background-image: none; border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; title=&quot;image&quot; width=&quot;617&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
这个就是Form Designer！它的功能就是给你添加、删除控件，编辑“可视化”的部分。在这里添加的控件等等就是编译过后“看得到”的部分，看不到的部分就是代码啦！&lt;br /&gt;
如何分辨Form Designer？&lt;br /&gt;
看上方TAB的内容，如果有“Design”的就是了！&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhTQxv8ip0ajAET-Am7RIJnbF-x0iKBwFRPHzDMQEHrSDwXFnHqyRrEsyOUYXa2r67_vmA16h3Bd0h_8wVEXyHZPABHL_Q2o9n9C8DEUiE7V1MA9m2Ug3Q2gx54yROl0TScWh1_y-fdAWwX/s1600-h/image%25255B5%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; height=&quot;645&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgKDfSn55CXAnIj903d2_lm9x2FYSX9PwJ8EG5EbNqmFOYcU5PI6Cxs4KcCVb-wNKlhJoPa-ZiMEIrN7F7Mrc_wyG24zGxnF2ysNtru_G2ab8Ftq_xwOxCLrnjZeajedSEke_5Tnp7dhsvy/?imgmax=800&quot; style=&quot;background-image: none; border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; title=&quot;image&quot; width=&quot;617&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
如果你不小心关掉Form Designer 了，可以到Solution Explorer 双击form 就可以打开了&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhJv4KrqAlWpQvBh6EakhE_ugs_GnMmJGpQe7EOyvKHVQGhrc3tu7D0YZPE0jYG6Hi_6CjpGHiMf-YqJwk2MX7ZrbNd5Rr0LGduQXirmq3bKWtnfI554T3JGXL9sykgV-FWsV8CQFXQVVA/s1600-h/image%25255B8%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; height=&quot;220&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjrsqn-bL3SMkCBKchWMLqm7Nycjs5HB2vA7Rug1zQy5-BVcFgyPd52u_r1EWPjBqywN6TJu6Swzo2_EZzKGsSHlGPrqUJZKzDCpVWZzzUaMf9NFdDnMAODK1P7rLHq9LOJueID55x-GfY/?imgmax=800&quot; style=&quot;background-image: none; border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; title=&quot;image&quot; width=&quot;283&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;h1 align=&quot;center&quot;&gt;
【更改Form大小】&lt;/h1&gt;
&lt;div align=&quot;left&quot;&gt;
如果要更改Form大小，拖着Form框边的小正方形：&lt;/div&gt;
&lt;div align=&quot;left&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEisKzpxphpG-t0AfEGPzTC1TxNW5nFi-WH2PWUgdMvW8GFljysHn6SnA2vWOppO89hqOO42YVZDDlrF9_-EIP8vOyQPPSTWBdY_QnconDOZzK52hsjEDe-X0JHB-eqMO2D2ffFlOz4DlTc/s1600-h/image%25255B11%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; height=&quot;331&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiVLyOHBGdiRY3wG-ivRjyayW-E-Ripnz7FuOgC2xO7FM7oK3VjdPpPs65-IOpa9K4VdcWGKDm5Glb_b8CH_BgQ2w_bVHX7lGon3Kovez6yyy4qjMvo-mhcdsOqnXmQGPFZOiv1VYFqWHg-/?imgmax=800&quot; style=&quot;background-image: none; border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; title=&quot;image&quot; width=&quot;327&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div align=&quot;left&quot;&gt;
然后拖拉就可以更改Form 大小&lt;/div&gt;
&lt;div align=&quot;left&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;h1 align=&quot;center&quot;&gt;
【添加控件】&lt;/h1&gt;
&lt;div align=&quot;left&quot;&gt;
打开Toolbox，然后点击需要添加的控件（比如说button）&lt;/div&gt;
&lt;div align=&quot;left&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhFNIEOYuSpIefD2n8LXut92nv4mU2pTg_1pwCP3mLTSj08VP9jLjoWjXrwip0tvq2jiCGPjdslx3m3p8NEnrK9fcQTQRB6oZoSzHdsimu_OLMmjydVe3HqL5-4DH0f472xlXW-NMYl_co/s1600-h/image%25255B17%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; height=&quot;117&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiCeKXhJfFMg-feXrrZtdpvP3l010eq3hrZSGMpuAIKJ-ykCNXI0SO6Sme3UFdHJVDdJukzKFJSqZlb64RxFRTzOTcL1bKeh_WLH784ww2_j1D8h020y_fDINAKsyQylsC_hEXOAF96-Z8/?imgmax=800&quot; style=&quot;background-image: none; border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; title=&quot;image&quot; width=&quot;382&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div align=&quot;left&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div align=&quot;left&quot;&gt;
你会发现到你的cursor 变成了：&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjJ1TY0EMIrBftDCTUqiuMXzC1zNXn4AvfdmADLiN0gCKkaJKX60Npf739QZOUu6XDmfCS1oXI_W-E2zroiB-gnuA_2fdQZEpLDtm84MRdIjGMu7a-R0jARUVy0Fh6uRB5bFqPjEvjKDEg/s1600-h/image%25255B20%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; height=&quot;30&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhhGfjxytj5EV8BfwhIIBXvg7QxKl761bH8Myav1rfbI7xwL5c2SnXL-rcMgIBTSN6UMCEX440af5p6tlTUSrs-vXPdVL8mdQcv0C0q1Vx5eiF32rthCz8IYGX1MaoCuMOJbjwf5e7PbaY/?imgmax=800&quot; style=&quot;background-image: none; border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; title=&quot;image&quot; width=&quot;33&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div align=&quot;left&quot;&gt;
然后点击Form 就可以添加button：&lt;/div&gt;
&lt;div align=&quot;left&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgOKtqTTOE19k-cfzZbBOhYKDu2c80axEyF1mgbAI3Oxuy50ftAs1rc5bqVyEyXKgIODcwKJ9cL4cdSTOII-S0GWds4qnf0GA51B2cJx0-gMBiwVw6MNmhQPxiamqknjLzNWaStxMFZzTM/s1600-h/image%25255B23%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; height=&quot;267&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjykzEwHsJ2IANB0SwsvRug7ACxBUZRJQXuebSIDEXtc-uposXXN-TnwLbGlzxT4repIsPYT_9XOIm6bbLwSQAyrRnX4kvhkZa65yYQBkhPrqurfHsRi_MaTRDvFLRCyE5yJITUTRpbyTM/?imgmax=800&quot; style=&quot;background-image: none; border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; title=&quot;image&quot; width=&quot;487&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div align=&quot;left&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;h1 align=&quot;center&quot;&gt;
【更改控件大小】&lt;/h1&gt;
注意到空间周围的白色小框框了没？就像更改form的大小一样，拖着他们就可以直接更改大小了！&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgyork0CuM3uUOBaoikcglARQLpJsgv_ItV1PdSFdSCQIQ5i03X-s5I-N-yrraubi0NpxfY5TeSmv0Qy0ZH8NVKgUB6QfpoWrNmB3Glt51HNc3AI85XXm_1G-3CGrnnZCnTVeULE2Lk2EgX/s1600-h/image%25255B26%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; height=&quot;226&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEijbg65nluW_9Q8d6olaoHDRJxBC7N7RQ9s0ij2gAchXim3RW0BDVohShyphenhyphenf7e9XcOwV3M62b01-x7cNFLewQgFla9na6mWOTTYgskYGc8G2b0-vqTmcEvCHKopmcacVjpn71rPklXnd9Uw/?imgmax=800&quot; style=&quot;background-image: none; border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; title=&quot;image&quot; width=&quot;235&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
注：如果一些控件没有该白色框，那就代表该控件不能改变大小！&lt;br /&gt;
注2：你可能会注意到groupbox有一个额外的小按钮：&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgwVx2ZDi0OJlmbGpdH_77sc5x4dl9VPn0tsoWd4MH1FCj9MGSz5ZiJIiCBpWGQdK8mfT96gF1t9CcmdhlmSXQBIZ6xABei5dkTYe0rkqHAEoddvCyXFSYVJTkd_t6OVABayobPuiEz_m8/s1600-h/image%25255B29%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; height=&quot;24&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi0-kyZKR2g7mcFNmLWOGRaAs1HLYGCuS0t2uGAZHbSJfRXF7Du8bi0ykGWfIJzmJYx_0Z0nIpJjzr_yTNR0De66Fz7aDzdmGRduQFcTELL75IVPDZt1IStbiFyTzEY-wmcDoP2HUiNqcQ/?imgmax=800&quot; style=&quot;background-image: none; border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; title=&quot;image&quot; width=&quot;22&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
那个是给你拖越控件用的：&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiwotgoC38K715SiLzOibgCMz-MpUqALRPfMDE80ou3736jGz0ENP_DC079YUpgYxll9Y-tETaWdw4BFtNue9lHWD6oArQAZaqTaVc1rtrF-v8LaDnJPPA-To_kD8isK_qPOSAOGI7U7bI/s1600-h/image%25255B32%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; height=&quot;147&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjGKj6VV10RaYn9gv-0cEPOhbMHxgYQZiAoZ8NHynXUKWcVtxEO5JanbxiIadeRQ_rMvGkBrI6_vRiNq4DddPJWOdUbrNdKXEROub2ms_vS7RfntT3L8oN9iO3dwkFiChLQkueL7WFCjxI4/?imgmax=800&quot; style=&quot;background-image: none; border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; title=&quot;image&quot; width=&quot;248&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;h1 align=&quot;center&quot;&gt;
【对齐控件】&lt;/h1&gt;
当你在移动控件的时候，你会发现到那些蓝线：&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhHu7cNy5oNy-Sb1iuT8RB6vVdEuRPG0VUMyL1GXtADkt2w5jHUrwadb8tBY-nyhs92T0gkm7yec1imNXrxzaeBhqJKIpQza8IKf3O8WprYdbIRawHpqZ5TGrsp86RFn0qfbdRzLAx6jug/s1600-h/image%25255B35%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; height=&quot;396&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgTbS5Ppkse8GE8LNhPlT8WYOHIngg4RL-xTs4n9xTqfbYyQ2RppK4mCvTfztS_vGeieJ414aL5N09vr8W_c5pCIBR3Ub-TWZ-uzV7UApsHaE0scYEWaZYcv3wUgGHeA9UVI1D1wIkWCdxt/?imgmax=800&quot; style=&quot;background-image: none; border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; title=&quot;image&quot; width=&quot;238&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
那个是用来对齐控件的，很好用对吧？&lt;br /&gt;
&lt;h1 align=&quot;center&quot;&gt;
【更改显示的文字】&lt;/h1&gt;
Button 默认显示的文字是“buttonX”，其中X是1,2,3,4,5…等等，看上去很boring对吧？&lt;br /&gt;
如果你要更改button的text（或者其他控件显示的文字）&lt;br /&gt;
先点击需要更改Text的 button &amp;gt; 然后点击Properties （或者按下F4）&amp;gt;&amp;nbsp; 然后找到&quot;text&quot;属性：&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgRa9fM6_2wTXNA-QxHOfLNgeNZBFtWbUUaNzjj1Zb_i12fIJR33DTFojc1cUV6DasYe7Tu6St_jI2_xGsF8bLiQOCxGr8Kf2QIvHZ2Pw386eC29bKuu01PxEQ1KkvPmEvt-PBxs-rw9QBX/s1600-h/image%25255B38%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; height=&quot;625&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjYREm5ErTgCtZ8gAPDkjfohcC1BXc4gWsEcyUPYvz8lrTZMF6NACfThGA57Bz7OETjfs9RDIlzuRDppmDKWWmvGjXgGLMpyWJwOUNy92qtlaWoMmQKVqidtOpTywR5esIAzVbxKVczBDsG/?imgmax=800&quot; style=&quot;background-image: none; border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; title=&quot;image&quot; width=&quot;324&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
在这边就可以直接更改button的text了&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj3I2k5_5Wb_75lIIfxkpyO_P96bqs0pj96fBJw96HUmNyhxXVT7HrAAuu5qIrjcUHXQUpjkvQHQ1u-Fv0uJfJOUp_BHwUQL5ihaYsmpOZfWc43UV2WwjnQUxwPxBUhnyEmo_pcjRmVv2MF/s1600-h/image%25255B41%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; height=&quot;197&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjG5VgyJ4tE91hTI5qFtpRLmEF_y89BRXux_sKhYrF2xiGIcFTz0Ep0CTESOYYy7u0nSyT1QDQfIBZXbGR7ytePr5_1bPZ8NRkgDHllP3sTl0fsYkCwz8zSHfSG1tuK9UTr5Stwnqi58QM/?imgmax=800&quot; style=&quot;background-image: none; border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; title=&quot;image&quot; width=&quot;486&quot; /&gt;&lt;/a&gt;&lt;div class=&quot;blogger-post-footer&quot;&gt;&lt;script&gt;
SyntaxHighlighter.highlight();
var linkwithin_site_id = 1130633;
$(&#39;#toTop&#39;).remove();
$(&#39;body&#39;).append(&#39;&lt;div id=&quot;toTop&quot; onclick=&quot;$(\&#39;html,body\&#39;).stop().animate({\&#39;scrollTop\&#39;: 0})&quot;&gt;Top&lt;/div&gt;&#39;);
$(window).on(&#39;scroll&#39;,function(){
if ($(this).scrollTop())
{
$(&#39;#toTop&#39;).fadeIn(&#39;fast&#39;);
}
else
{
$(&#39;#toTop&#39;).fadeOut(&#39;fast&#39;);
}
});
&lt;/script&gt;
&lt;script src=&quot;http://www.linkwithin.com/widget.js&quot;&gt;&lt;/script&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://garyngzhongbo.blogspot.com/feeds/4532036808092495286/comments/default' title='博文评论'/><link rel='replies' type='text/html' href='http://garyngzhongbo.blogspot.com/2013/11/c-4form-designerpropertiesform.html#comment-form' title='0 条评论'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5319618319979683940/posts/default/4532036808092495286'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5319618319979683940/posts/default/4532036808092495286'/><link rel='alternate' type='text/html' href='http://garyngzhongbo.blogspot.com/2013/11/c-4form-designerpropertiesform.html' title='[教程][C#] 新手入门教程#4——初识Form Designer、更改Properties、更改Form大小'/><author><name>Gary Ng</name><uri>http://www.blogger.com/profile/00014057672539539340</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhsZBG4vlRwROuYGm-g5CtogxsqNYla9JcROFqAN2jkTVRF22eQwPOGuRRZnls0d6hlwlP5vZHPJFmQTdAX1REVuhomcl1YvquqkI9BFQJvkyw5KkpYy_43HC2Zv7e_yUvXjWc7n9F0nZFZ/s72-c?imgmax=800" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5319618319979683940.post-7440465789237978916</id><published>2013-11-17T00:47:00.001+08:00</published><updated>2013-11-17T00:47:53.845+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="C#"/><category scheme="http://www.blogger.com/atom/ns#" term="入门"/><category scheme="http://www.blogger.com/atom/ns#" term="原创"/><category scheme="http://www.blogger.com/atom/ns#" term="教程"/><category scheme="http://www.blogger.com/atom/ns#" term="新手"/><title type='text'>[教程][C#] 新手入门教程#3——查看代码、编译程序、Solution Explorer</title><content type='html'>&lt;h1&gt;
&lt;/h1&gt;
&lt;h1 align=&quot;center&quot;&gt;
【Solution Explorer里面的东西都是啥？】&lt;/h1&gt;
&lt;div align=&quot;left&quot;&gt;
这里先解释下Solution Explorer里面的东西代表什么：&lt;/div&gt;
&lt;div align=&quot;left&quot;&gt;
1、Properties 就是整个solution （也就是project）的属性&lt;/div&gt;
&lt;div align=&quot;left&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgBBSFipRYRnEMFwxxjCXr8ZW1vt0j7_dz4BNjTEXoFgjxrDzZDFHZJiaY1CbGB-na4Ljf5VdevX3hYa6AhD8-cB8bM8N6FhM1xgUi8hunAabIMk8rqjhazIicQ_D6V5nHTKFB0s5VvLO0/s1600-h/image%25255B5%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; height=&quot;328&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhTw1i0Yca9DIZAz631leal-IBS-zse71af1sKJzJ3MUypqgGFo2Viy2jgL_r4uZvef5nD1hd9SbC56AmrNU6pLqpx3ohFyTHuJ_WT-5ch3aWIt528z_NhC4BXGEUocYjByeepN8Szgc0PL/?imgmax=800&quot; style=&quot;background-image: none; border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; title=&quot;image&quot; width=&quot;301&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div align=&quot;left&quot;&gt;
双击过后就会看到这个页面，这里就是整个solution的属性：&lt;/div&gt;
&lt;div align=&quot;left&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi2-xNjjk8OS0OpkNBf32q7Va08nH4CXpO5ISyJXtVgGkXJAE-0Jfkb6X7S3TjNmWECQffwVhg4NmwW2oINU6oCzin77w3cyBFHAY4hp6NddoXBcCa6Nt472sJ0h6MVhiEDmYd9Qp47eZY/s1600-h/image%25255B8%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; height=&quot;566&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEijkH-fG6QNCYrMvRAOZPdXrTDynV5W_2D9hyphenhyphen562jwNwb_IlR_o5IKyazL-UNoM4hOXpy4-YrRLkTcw0Oqyly28eJstR25gZ0n-981o7P3coNDc5DIxpLhVUkOoXdyZ-2wO2thRU5enfy0/?imgmax=800&quot; style=&quot;background-image: none; border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; title=&quot;image&quot; width=&quot;1042&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div align=&quot;left&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div align=&quot;left&quot;&gt;
2、References&lt;/div&gt;
&lt;div align=&quot;left&quot;&gt;
这里包含了整个solution的references，至于什么是references呢，恩..先别管..&lt;/div&gt;
&lt;div align=&quot;left&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjdE6Ksvt8NuJukqVzZzYsTw5ClAucxxMrT_j6Qd_e6Xz3I0pcy1GJmbj7AJDGySDagDdApVl_TCOQ54DFVB1gE249ASwv8FQHAjFcio88Da4eqDJLFMkDs8fDbb7aGGmmMNbDr8inOoo86/s1600-h/image%25255B11%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; height=&quot;388&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjC9mshujnHu9JTLghcIe_4oLMgquueeZOsqA3T_PhkoUyOW3gfmDPj57ptIfcj6VDBKuRNpiK5IvQb4YfwGgwvTcjfVtsNnWPAWsKhgrZnN2D_MF36-YTk7H_qhuOLHdtLoMarMigyqX_C/?imgmax=800&quot; style=&quot;background-image: none; border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; title=&quot;image&quot; width=&quot;299&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div align=&quot;left&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div align=&quot;left&quot;&gt;
3、余下的就是程序所需的文件&lt;/div&gt;
&lt;div align=&quot;left&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiLLHA_IAZmdJtC1nvvu2tDJL9kaaUccRpg_jgnSgin-Ecc6Ecx-SxJwM47R2ej75snkz1TNYZCBqFzU39SqP3iDomH-FH65QNUu0UU5QNSUHulYVMwjRdcxJM2rQkYE-GyfhACAdtg1kU/s1600-h/image%25255B14%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; height=&quot;383&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjBxVH_329ZvoQZxxpsgcf-hPlQbQY0MY6NanXbsb52ggdMMEC7Fe9Go5wSn-kWw0enPgwrTAVknpD_HrGuqVzCqoUdrcCwpF1-ATSAS9fOtT1lbPhJVb0inhxWVp8INC1wMaxdzgSjyA4/?imgmax=800&quot; style=&quot;background-image: none; border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; title=&quot;image&quot; width=&quot;306&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div align=&quot;left&quot;&gt;
Program.cs 包含了程序的入口，这是几乎每个solution都必须的&lt;/div&gt;
&lt;div align=&quot;left&quot;&gt;
Form1.cs 就是你的程序了&lt;/div&gt;
&lt;div align=&quot;left&quot;&gt;
Form1.Designer.cs 是VS用来给你编辑程序界面的，这个文件不必去管它，因为都是由VS来控制的&lt;/div&gt;
&lt;div align=&quot;left&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;h1 align=&quot;center&quot;&gt;
【如何查看程序代码？】&lt;/h1&gt;
之前我们了解了基本的VS界面操作，那要怎么编写代码呢？&lt;br /&gt;
如果要查看代码，可以在Solution Explorer &amp;gt; 右键需要显示代码的文件 &amp;gt; 点击View Code，或者你可以直接按下F7&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiCsIqoIgP-WcfAqRnnVb4rwfn5Ybj7HiXEwrjlCI7H4vk43Qukf2493d6KEBRM-saapFA56Pl0DRg9T0IeSKre3svFy5Os2V8K04si0y41iFYgfmhUnAS5nsWhB8yTJcbQR5cEyNZHs0g/s1600-h/image%25255B2%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; height=&quot;353&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjwlwIgHWrZO8YIlQwT-Jrm1MqOgI4QMEvfUeTy_HTsmlfrFFsUwRHAEvCVOk96CStuXmAPng90k_rAQqtoqAAAY_xnQJJHlLNqjSw5Yym-yD2VRme9r8xAwuFmOPbIQZtbZkqx0eUslehQ/?imgmax=800&quot; style=&quot;background-image: none; border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; title=&quot;image&quot; width=&quot;374&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
过后就会看到这个窗口（你的窗口可能跟我的不一样，不用紧的，功能是一样的），这个就是用来编辑代码的窗口了：&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhDFqTtMbi5nkL333xIgUb7-zWBKCVuGJIUbfRZesL7Hm45smaYyMnEZYoocro5d9vhO53KNzYJYuRDqBRQQ92PBFVcZtTvSB2UQrXdTkCN8UnfVkqdsW7HVq1KvBXxA2_Yg5iQF9b8HoWZ/s1600-h/image%25255B17%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; height=&quot;637&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjUODte0szy86UsL1jYa9fk3xk25EQVXwRXMC0OQAaQK36BSyb2lpW6acqmzrMrfsfwe9Ryr5f5MCfJ1y7H1lmB4lhz6tufx5RAyzdq2MxzEDGjAlJmaeQFEf222Pe-SoK1WKCD0GghpoY/?imgmax=800&quot; style=&quot;background-image: none; border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; title=&quot;image&quot; width=&quot;1063&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;h1 align=&quot;center&quot;&gt;
【我的Project储存在哪儿？】&lt;/h1&gt;
如果你的Create New Project的页面是这样的：&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgZmt6d_-WExlNcnR2hIUrQ6sxw6ntgBGAYgzEfaai6GtXAsGvQbffv8dbMzZTgd1yidCBD7U3Gn2EQDOv3MQrzD0pL-Z27mGx207pIuUOn5zylZPgNBiUnFSTn2xDWe_joxudqDUC2XzDW/s1600-h/image%25255B20%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; height=&quot;633&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEion__n6ErijZPeiJFKSMufVjfjBIDCYyyEGjqh-DXcVBa4P6jkSFqojGywPXjxOW8vLq-DOKTLgmUbmWhc_-EdNKqbg0iGlvSfjOty3HX_GZX5t9MNgPE-YLkKIIW-nVhp1BHp1NfgwQde/?imgmax=800&quot; style=&quot;background-image: none; border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; title=&quot;image&quot; width=&quot;955&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
这是代表你创建的Project是临时的，你必须储存Project，你才会看到你的Project文件夹。按下Ctrl + Shift + S，然后选择储存project的路径就可以了：&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhF-5YGFU4u8l4MGpKcFVISTY8S3a07Ee_QBmFVlzl04loqL1mAmbr6siGZi8Ex5gai0WS-8cEdSVjFpBI31eFjlUEQgKjZZ2GwVUlYEw9tnsGJu6lQQ4p2gPCkeFAPcbMbsGATsz_MYblW/s1600-h/image%25255B29%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; height=&quot;235&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhR9bZs1N6nRasiqNRMaw3wT8UO6myHE0U_jsGyqqAl1l3Mp3PvaRh78yWHp2DT8NoZLauvwC0VRykHeSK-dpJ2T4slm6GSGNVFPJnFCoBt5xcvUOZ33jYIvOTr0YnAwbpxVTi7kwryI0I/?imgmax=800&quot; style=&quot;background-image: none; border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; title=&quot;image&quot; width=&quot;798&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
如果你的Create New Project 的对话框是这样的话：&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj5g8ED2rBMcOUIFHsXQUGczrsKIWUN0mLv7R4iK5AloCYoNyPyvzC9hWrPhMG_OQo9o4bdSj9gEKnpc_xG2RWDY2eIakh6vWp2HsnlyuuqtGnVa4rK-4jr3wzfmIqmsADqLhfnSXC9oSA/s1600-h/image%25255B26%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; height=&quot;619&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiYar0KJP9ZbspziJVxOOZBLAikAuuHzgrMGBEZK2s8KorIMEj58dTiOknx-V_adaJK3gjVkQ2NQbngtbL7Vwomv5LRWMbR6cO4VtqeB983kqTQkb93ExeYuLiFwO8mhlSVF1d3li6tNDQ/?imgmax=800&quot; style=&quot;background-image: none; border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; title=&quot;image&quot; width=&quot;955&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
这代表创建Project的时候已经储存的project，那你可以直接到储存的路径来找到project files（比如我把我的project储存在f:\users\garyng\documents\visual studio 2010\projects里面）&lt;br /&gt;
&lt;h1 align=&quot;center&quot;&gt;
【如何调试程序？】&lt;/h1&gt;
要编译程序的话，可以点击上方的类似start按钮，或者你可以直接按下F5：&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiNvC9pj1_IHePCwYY5SSC1QxNGTUollv_HaIxJ1KvMeoUFUaJGG1UMOSPQ7lXukOgfPuCtd1D2JPY8304l5o8wyRSerhgLebmjNJHgatosMZ7QkQQgLjZy93IFj_XJZjT9DrPcn8SeNx0/s1600-h/image%25255B41%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; height=&quot;317&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjvjGAy1QZdsGHCb5ob3louX1uNE5aabt8QuVHpLqWUSQibwGMzZybSrC7aEFpA2z4yTR87NrnpV2qJNga9GlyaZGXqRNn52_SMWWG600FDm61MeGUqN-z-Q-j6aR95oZfDDCMVvgSu8SE/?imgmax=800&quot; style=&quot;background-image: none; border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; title=&quot;image&quot; width=&quot;373&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
如果你找不到这个按钮，你可以到View &amp;gt; Toolbars &amp;gt; Standard显示它：&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjE_A312C5qIxnBhb4Z7OYJR9uetv_T4_ALtSLljmsF6Vs-iMG8yVo4QrXa9z5ipQdZVTjbVxPrAAknriBVYjGLowC0sHHHzF-4p0GryM5qQmP_4RcCuoxh3xIxjtMI10LUC7JcEKoANWkg/s1600-h/image%25255B44%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; height=&quot;672&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhUOd6OvYVfvIEtHIZGoml5j18Q1jXlAGr9W6YGXa4ihGQbk9XVMDBAIEQLypwqpo2AfNj0SyBLVFJYy0IpDNWdwEW8iIi6sREWCVbd4MyMCRLOseBnot60oSvf1jU8GUKXr_nfJqfqROG7/?imgmax=800&quot; style=&quot;background-image: none; border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; title=&quot;image&quot; width=&quot;639&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;h1 align=&quot;center&quot;&gt;
【Project文件里面都是些什么？】&lt;/h1&gt;
打开你的project文件夹，你会看到这些东西：&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjEjHF69BciyYlQPt_kITbDWSzkEn_7NcJ1yX2_ng5jwOCOIrO9rrR-o12kEEba_ef2AhqrblVfLoFK35otp_nl6VBBiWlUuRRBucbjxnCYLJmnZa2FDxv0uB6_4Y6-MFYYRjXC7shH-2Q/s1600-h/image%25255B32%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; height=&quot;260&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh6XuGr1EzgZJUzxlTAELIdjJFvev-G0v76RkIOUiF3nUQ3Gv_Aa7VbmtqjIVu98TPUskohrhizB8vybayboUTTwIiEw240pGr3g2LW2I_xjvFturPuR6YmhqS45VTRPrNf0W87gU64iJc/?imgmax=800&quot; style=&quot;background-image: none; border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; title=&quot;image&quot; width=&quot;670&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
*.sln 是你的solution文件，点击他就可以直接以VS打开文件&lt;br /&gt;
*.suo 这我不确定..&lt;br /&gt;
&lt;br /&gt;
打开WindowsFormsApplication2的文件夹（你的可能跟我的不一样），你会看到：&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEilSLi2xvRTTzM36y2lzcgWB0fxGRIT3NC6rXDeTLmZtdRanIWe_hyphenhyphenasMtfg-KzdzQnpCEiUxDTN1s5LUx5FpwEFsfzn566RD7B7BZ9Wp_Z3vrezmz32RlpDVN5pL1RoTbgaN1Ewugo9pM/s1600-h/image%25255B35%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; height=&quot;295&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiDcB_BytcNWxdJ0gCmn5W0Sh7OvkLFjdfONEhdDVG0xzrJnyk4fw-iFjwjnkK9WcWGLDn9MFnQj6TLLAFUVcKacu7VSnnuZrlCDpcWuOLuSWRlUc2pwteNJDKrOLN4upgxjKHytiAgLWRo/?imgmax=800&quot; style=&quot;background-image: none; border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; title=&quot;image&quot; width=&quot;681&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
*.cs 是储存代码的文件&lt;br /&gt;
*.csproj 这个类似*.sln文件&lt;br /&gt;
*.user 这个似乎类似*.sln文件&lt;br /&gt;
&lt;br /&gt;
bin 文件夹包含：&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi6Gz_Kz3NxctPf5dNr50kvDLt8WOxWOwGr8gxC23V4RAkSzxnxLv7wEt1ePQyO4e8qSNM7VHzN135mzraKxBcd4zcMshE-CogYP1vKW-8XTIoI439qycv9wVsl63x5TPHpG9A5vzrQ-44/s1600-h/image%25255B38%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; height=&quot;134&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiBcYDagcpKHdYc2j49RpXVucvKmbAZNDL5Dy3lCw50c6F5_v3tzJuU0h21FC_j1A1Wz40TLZBHgJQvJ4VmH04XB6fOGZlBZ3bZWvmjZG7AA7-HLWoR9TOOTltyfBm_CC6kHDZjafYnGXI/?imgmax=800&quot; style=&quot;background-image: none; border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; title=&quot;image&quot; width=&quot;536&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
Debug 和 Release 都大同小异，里面都包含你的exe程序&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg2gy5EMNpH2qAjGZuYFsax1Nm6-GI9ZeMzsF0UrREmbXQJdyDOEFXvg0MfdFvETy1lFWicGVbgPyceZWyDCQSHsMC3HHoGQYSjzlAbMnpyIEUiIdXbtl3HbUtBdQZ6cPyTl4THtZLysZ0/s1600-h/image%25255B47%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; height=&quot;223&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj5GfsjweLYg3yzaiLdJar9-DU1s5Fc1UT-gmBl-rxEp3MPWwX-EkNgZ86XpWE2gM9tC_Qo-tO5V7UilGRHbiOv_kU3_Ss36c_pKtv5xuAwgQWAWqhSKO47-j-f1KCd6jEvEuEWs32Kkfro/?imgmax=800&quot; style=&quot;background-image: none; border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; title=&quot;image&quot; width=&quot;651&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
Properties 文件包含project的属性文件：&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEivaNPwD6SQuNyOZeYIiE5ic2SP5-_9Ha-SSQ5QnCJkulOQX4A0nuwRTpuk3DmOenNKzXL8_qA7BGeOxPhzTrXLDGbyB3ldNDUQQ52tj0bCjks8ES_CcKhXtY6mD-gKsu1dLJQLCto4gpme/s1600-h/image%25255B50%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; height=&quot;136&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgEELa8FYQrRqU8ejCO4NQR_IDn4P0fg_cQKreOL-GDAGM-yN3Z3F20yeXdw34LLISSyyw86LlUcX0hrAxl3mTWlX1r8Bi7dCrvxFKpHHqZx8rEBxBTFVBY5nthoW2GKsw_DZBoVrqDiAw/?imgmax=800&quot; style=&quot;background-image: none; border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; title=&quot;image&quot; width=&quot;609&quot; /&gt;&lt;/a&gt;&lt;div class=&quot;blogger-post-footer&quot;&gt;&lt;script&gt;
SyntaxHighlighter.highlight();
var linkwithin_site_id = 1130633;
$(&#39;#toTop&#39;).remove();
$(&#39;body&#39;).append(&#39;&lt;div id=&quot;toTop&quot; onclick=&quot;$(\&#39;html,body\&#39;).stop().animate({\&#39;scrollTop\&#39;: 0})&quot;&gt;Top&lt;/div&gt;&#39;);
$(window).on(&#39;scroll&#39;,function(){
if ($(this).scrollTop())
{
$(&#39;#toTop&#39;).fadeIn(&#39;fast&#39;);
}
else
{
$(&#39;#toTop&#39;).fadeOut(&#39;fast&#39;);
}
});
&lt;/script&gt;
&lt;script src=&quot;http://www.linkwithin.com/widget.js&quot;&gt;&lt;/script&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://garyngzhongbo.blogspot.com/feeds/7440465789237978916/comments/default' title='博文评论'/><link rel='replies' type='text/html' href='http://garyngzhongbo.blogspot.com/2013/11/c-3solution-explorer.html#comment-form' title='0 条评论'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5319618319979683940/posts/default/7440465789237978916'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5319618319979683940/posts/default/7440465789237978916'/><link rel='alternate' type='text/html' href='http://garyngzhongbo.blogspot.com/2013/11/c-3solution-explorer.html' title='[教程][C#] 新手入门教程#3——查看代码、编译程序、Solution Explorer'/><author><name>Gary Ng</name><uri>http://www.blogger.com/profile/00014057672539539340</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhTw1i0Yca9DIZAz631leal-IBS-zse71af1sKJzJ3MUypqgGFo2Viy2jgL_r4uZvef5nD1hd9SbC56AmrNU6pLqpx3ohFyTHuJ_WT-5ch3aWIt528z_NhC4BXGEUocYjByeepN8Szgc0PL/s72-c?imgmax=800" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5319618319979683940.post-3992995756906081050</id><published>2013-11-16T11:09:00.000+08:00</published><updated>2013-11-24T16:01:07.372+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="C#"/><category scheme="http://www.blogger.com/atom/ns#" term="入门"/><category scheme="http://www.blogger.com/atom/ns#" term="原创"/><category scheme="http://www.blogger.com/atom/ns#" term="教程"/><category scheme="http://www.blogger.com/atom/ns#" term="新手"/><title type='text'>[教程][C#] 新手入门教程#2——初识Visual Studio 2010</title><content type='html'>&lt;h1 align=&quot;center&quot;&gt;
【主界面】&lt;/h1&gt;
首先你得打开你的Visual Studio 2010 （废话，还有一下吧Visual Studio 2010 写成VS2010或者VS），先来看看VS的界面（笔者用VS2010 Ultimate，然后装了一些Plugin，如果你的跟我的不一样，别怕，没关系的）&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg1RT6GqIIz4uPJHzlm3MsiYXxIKYPEka1oNa00A99mMRNfExMOp0gAueoLtYkzezaVpDK8xVnmR64SkcOCbKBoS6ZU9z1FupWn3sUcoByPxbZK6mdAz_474q_E8WLsZJkmi0vLUFLLQ1Ec/s1600-h/image2.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjZCKwSsw8ET6hCVdDoBmPsg02Vvu93KoFydaIvENv3klzjnQW3W2AynY42cGGZulpo-q-E65WLAPVBBIuvvDMRq_AD8ssP3Dm5ruUU-U__IYkKA8UsYIpOeYyz2KG33Eo6y84-CRcRO14/?imgmax=800&quot; height=&quot;731&quot; style=&quot;background-image: none; border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; title=&quot;image&quot; width=&quot;1152&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;h1 align=&quot;center&quot;&gt;
【如何创建新的Project？】&lt;/h1&gt;
开了VS要做啥呢？当然是新建一个project！那要如何建立一个project 呢？有两种方法：&lt;br /&gt;
1、点击File &amp;gt; New &amp;gt; Project&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgukNuYE21xomw-afiAUG8HeZagTXDdsFLl0cfIeCCFlFu7BXrkYcw7AU5QkRE5bm5wCdia9fFSRo_TlgVZUqdeB4YvYTIHnmU2oSQAs_JMENpet_s5Bt0o6nlniKbQdrE2aB97rraYPi4/s1600-h/image5.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiEbOTuwY5HxpnRqMZ9wWzP0kJIevPLEsnWk137rRid4ORJ6dXF2UChyIVqqu8tdC0m19vJiGHUc4CX93HB7LGdOlvIHEB9NvI-t6ZMUbtaKuSVRI6jSM16CsX56GMles3olR1j4oQ9QuA/?imgmax=800&quot; height=&quot;374&quot; style=&quot;background-image: none; border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; title=&quot;image&quot; width=&quot;678&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
2、如果你懒惰移动滑鼠的话，你也可以直接按下Ctrl+Shift+N（记下这些快捷键，会节省很多时间的！）&lt;br /&gt;
过后你会看到这个窗口&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjtjw_Wgn_ii9DmJmuAZa24lmqOskgxlpe7JJ8kTCYkY0tvaLp7_jvrH6jB5wHBWOSc-W1iWDzmU8q6K_9la-jzfz63D3B4OcaR6vW7zC8qN9MD7AgjGBmvO8gyj3McEUZUJ8HEs1yovhI/s1600-h/image8.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh-UeWhF6CwDTP3UldzAvsqdwdWLkoPWt-2gwWK7XV_lfm3z1bvVI1e1vOsh_Ij9zlzLqljTbvt_YIexOVnbv1makTwSyxld_W7JpzjJWllCeNvsXHnMqJ3aXphAAeMpHkckMMvybEP8EA/?imgmax=800&quot; height=&quot;619&quot; style=&quot;background-image: none; border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; title=&quot;image&quot; width=&quot;955&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
点击Visual C# &amp;gt; Windows Forms Application，在Name那儿给你的程序一个名字，然后你的程序就要诞生了！（兴奋么？）&lt;br /&gt;
&lt;br /&gt;
如果你看不到Visual C#这个项目，你得展开Other Language，在里面找应该有的：&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhs15TekR_KT7hyRaopJXgkoubY_td_lcwkNSKA8n961kQoMFSWpqaZ7xwDB1mTKqlOLwl_epyptpm2CVRS_mgPvy_OTqIietMmeBIpETry7Z7HOOWRdRQ2de-8AAyMraJu1orrtJW9aMPf/s1600-h/image14.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEir2g7b-qt2PhyK77dz8cknrF4gadgRfiJrQxgWF8hIEycRIchhbygvJwGBXugR48ovbjxoy1sVoNzXSG-hj6MNqqR99j3Qx3YYKZqsPfGb_ppc7P2zAu-oE9Osc81z8B6HpaFfPnRlErg/?imgmax=800&quot; height=&quot;619&quot; style=&quot;background-image: none; border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; title=&quot;image&quot; width=&quot;955&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;h1 align=&quot;center&quot;&gt;
【编辑主界面】&lt;/h1&gt;
创建新的project 之后，就会看到这些（或者是类似的），而且你基本上必须这些东西：&lt;br /&gt;
1、Toolbox&lt;br /&gt;
这里有所有的窗体控件，可以直接拖拉到程序窗体上，比如说我要增加一个Button控件，就可以按着Button，然后拖到Form Designer 那儿放下：&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhpucnBUOry38W9mAdPzYG27ePmOdcq828B5w7Uqi443RCZm1St5sL3WGpA1eMC-lulWpCr5byixCr6FbMVoNs2blEQ_GrjWgcad92elYnlsS4gRnXLnQ-FXp_QgUAi2bCHFICKb_FX97w/s1600-h/image%25255B6%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgsPHg_sb1Bco6PikSY9KEFW14dBhUBePHtXAf-Xbq8J5o5EJoJqhWnwuPvlSE5lSYWxa_nrTmTKe_WvEkKhwzBCT2EnbYI-2ajWxsEBYb_xiPP5KumUMJVlYEMnMiGLn7Fw9LISfDkLfg/?imgmax=800&quot; height=&quot;722&quot; style=&quot;background-image: none; border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; title=&quot;image&quot; width=&quot;741&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhwYcqNw6MUm_2TeqvtIplPvSmmj3R6942l30zDlgzckcvIELRmGkBY2jbH3M4TqbBjvB-is5X-x18HQMOmBso9GI2u6B3oLVNJngmqihyUj97vwlGHe8_132-S9PteAzq9eh5ujsLzajB-/s1600-h/image%25255B9%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjpMRI41UyKeiKkL61bN55p1jyMU9KdKZq8HgIX7MjzhP9FdHwtwzp1_CmKYL_jvoFY1evNEbSHUNOg15kyT09-yhjq7HK3Q75d6GhrhyPgv2r4fSYnxfy9W1jFzuAIC7L_iU5YT_TjbO4T/?imgmax=800&quot; height=&quot;377&quot; style=&quot;background-image: none; border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; title=&quot;image&quot; width=&quot;348&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
如果你的VS没有Toolbox，可以到View &amp;gt; Toolbox 显示它：&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhlptU1-WE60G0neOGK1TJyhR8nZXWvAkCmcs-brJJXPNJTEPG6JWCwPcXlW3FhGwgzqvtqTCevVBwwg7p9wlCgesCWKw_bzylj93x8g1PwSOqoH6mPzlu-4MwuHVHxx2l_uOWx9eluCLw/s1600-h/image%25255B12%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgiFVJpImLh7vkepXO0s8eKSWHbtDC0PIHt5X2IYj5HcKTMJUbhRamx-Zxn0C7YqZCfC_TQKTDCltzW_WO4W2vGuS0WfiqqyJqX3Rf3hdS9TMW5JnFbIRC9gCRHHw1Bl81kW62xNGhd85Rh/?imgmax=800&quot; height=&quot;690&quot; style=&quot;background-image: none; border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; title=&quot;image&quot; width=&quot;386&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
2、Error List&lt;br /&gt;
这里显示代码的错误、或者是warnings等等&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhRco8Yqd2aflLhV6eJfkK_JJflVbu53NhExT88hv2T8wCJh6lOSIIqNVB9k_Gkr94e6BLwxMjwOCMuL3uIwbL7kVw-sKuPvVGKVQfI-pcHdoEuLvgHZzoN8lw-oQIWUgSCFg0BZob2gHo/s1600-h/image%25255B18%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgvZ3pho6O4qV6VdmKuzmVAQ9f3usYNz541_CSBhlilYyCkUekiDd4T_q_fkX5Pzm8efOhko3XWARDQ_7IqFb9VWizHFrleGxmp3uz7XFmD96Sp3F6Vxf63m8LubnSJOByucMUJW0DkYjOB/?imgmax=800&quot; height=&quot;259&quot; style=&quot;background-image: none; border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; title=&quot;image&quot; width=&quot;1280&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
如果VS没有呢，就到View &amp;gt; Error List 那儿显示&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgOcfMZPxJYWnkOBWxMCHGl9juf69Z7gDbeYqDL11Axe5q1wkvr3b1bl_G7y2a_81tflun5XBXCBXUcRp3I4G2r7RcjeAel8_-FnSvpFGzdKPbV8pouY7qwhltmL12i7oUVwlP4H9736YOR/s1600-h/image%25255B21%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgcvRX8QN0iPaRMFA1EGaG3H10YRUjHoSb_xHHN3jNQnvPQ3H_w5Yy0bpOItzCcNm5_ixx7nvuvBEYav3bFzq_U7cpHoCfaUfepGFh_-0t1ecmK9l09fVm4BONGLp2oBQplJnG65GakBiU/?imgmax=800&quot; height=&quot;451&quot; style=&quot;background-image: none; border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; title=&quot;image&quot; width=&quot;327&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
3、Solution Explorer&lt;br /&gt;
这里是显示你的project 有什么文件等等&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjaT_9UOk67TXgqjZtVbEWUmlJ8kuvKgdzWpC2fahKXmSbKOzM5TXGzQp0blwkIVqFIpvIqUKL-y1NiuiUohttsf8GYAIZyYglatDOT3uQ7SPmH7slaz8tZHWX9noJk16CXjC3O9EKHdj4/s1600-h/image%25255B24%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhxdYeBJKHeKR1G02dpoZ-_qhWhUlMjZheqgJ58w1zVZj_8whJiOzGl5ZamBTZv0dDISOoD0MImlb4REI_t0rGmrg2IypHGpcWq7UJpo0lgFr44vL3fZMf7qogcBUZIXkE-DlX4egQoEisd/?imgmax=800&quot; height=&quot;433&quot; style=&quot;background-image: none; border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; title=&quot;image&quot; width=&quot;311&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
没有显示的话，可以到View &amp;gt; Solution Explorer&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjJ83Ybt2bOYpjfrgGX5o4YJBRf-BUKIsS26t31p0a8pn88YAC_LT52XfmuGkdyai4p-WkhGhXpEeFSJpKvHJdH0sICcruCy8E8GGwY7VTFkCBxRBmPwl8yVBkY1TP_2IAytTK7CbvNeRk/s1600-h/image%25255B27%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg5_olKvA7ZZl6-Vi3GnZmml-diUbWh9Z2a1WwlR8ktavY1j_WuHm50qRBURXyD0ZmqqGR5-SiwJ0tpa4BKxd_7Y_WImA9pqUubqZ12B_v8pLnR6AbOwrEHGuaSHlGdJEBOsV3dvjEH5Fs/?imgmax=800&quot; height=&quot;355&quot; style=&quot;background-image: none; border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; title=&quot;image&quot; width=&quot;326&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
4、Properies&lt;br /&gt;
这是显示控件、窗体等等所拥有的properties（属性），还有event（事件）&lt;br /&gt;
例如这里显示了Button的属性&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgF0X43TTZOUdK5CKkp-kquekQdCxdr94FEO7dhGDFRQ7mABpRKiFUdkc7k8lG0pSwqAMFfFwY5zmJp6YZ2oTiNm4Ct1a9nJN9oi_SRG7dZ9JjFIEQ2x3OvStZ7TSf9HtwVc_WykD-W3cHe/s1600-h/image%25255B30%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjPLZrRQqr8SWXy18Acm-eBpj_egmvX0UchWhvwJadJyC1a_G1Cq-VkKyRyQAVXqCVVW5ZtLUIsZGuBkBAV4ch5daXvi0diTBN-XV8hkDa7el-CDFRgU_fMHwKIfc6nzDfr2t83XNPfFMs/?imgmax=800&quot; height=&quot;521&quot; style=&quot;background-image: none; border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; title=&quot;image&quot; width=&quot;538&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
你可以到View &amp;gt; Properties 显示它&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhpc-EkEicuCcM_BCo2guUg1shX7FAFIzb4365AJB_2xux4-q9QRS8bRXiaNXrvUsSLgqXv9QDhUxgViKjzS64Q20YQtrwxnLSrSOT1m5BKVhDEE2NMh11U29o1XmCmjSW3A8MAsuBi4pU/s1600-h/image%25255B33%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgCrhT2if8lOGRijiLmPOaVgGxLqU6t1XEdHjQrFC0eXVpjgLuJeHV8BF_JeZKRRtrXRb7kqx2Q0oe8gJDGlgsX0l3ypgjzWqqwDXjvzbqBqVS0n-YinBHxWl15r4YlP8QKX1uC6D71kNU/?imgmax=800&quot; height=&quot;668&quot; style=&quot;background-image: none; border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; title=&quot;image&quot; width=&quot;330&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
如果你不要一些窗口，可以点击上方的小打叉关闭：&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhJKfwnsYiSfORym3dXkor6fcT92-tRk0TRVUZVyMG3PjiEu6WpWMeUbcB8O0Dy28JyqqSnZlP5udOTm_bVSZnrgpgZiujbauLQZYCUvz2qPs3krK8cvj0lhlH-fIYnkOHn7cS1s7UE7WE/s1600-h/image%25255B36%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjqfkUg0NfCq2OBtgmIECz1y2LiVOI66FMpodQeaTrr6kWhtQ2SsroHkxrC7CLzlhHquuArHuIizzAQ8LZv-S-LzzVuCAaSe4hU4wphAVYTaAb0HggldSocnh4hWoUQQnkx3167JEhFwNs/?imgmax=800&quot; height=&quot;162&quot; style=&quot;background-image: none; border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; title=&quot;image&quot; width=&quot;325&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
而如果你要把它hide起来呢，就点击上方的pin按钮（这只是暂时性隐藏，如果要显示的话，可以把滑鼠hover旁边的按钮，或者是点击，看图会比较明白）&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEimZuigeWtCCmlGpsj36jlwCRyLd1hyeOg7QZz5ORNaNygb3Wj53LzLAjmxjsc-Fdn2W5zZY4LjRze0rlejy-PuptamnyzeswE7kLDn4DxenZ60y3tDsxYiRGwuH7MFJbwuGrEr0e0u8UrR/s1600-h/image%25255B39%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg51kGyrWMbUED9Fo6otaqzyvv767aSQprxv37ehmfGcu83iQLJGV8EEe5EJ-y1mVJryJGWhLiRtc5X8cbgQdTaMieigbZBFaPO43mLV-TDeO_JuNPgWKNfiHXhLbQCjxMxBL8SRd9d2-A/?imgmax=800&quot; height=&quot;86&quot; style=&quot;background-image: none; border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; title=&quot;image&quot; width=&quot;350&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
如果要恢复显示，就把滑鼠hover在旁边的按钮：&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgBqUGnqRIOl_ZIkDfgT_KrNZqJA3T2__rK-Aojh7DZfRWW4lMQG49U9H11q8dKHZo0ZI1yYnEiOo19xlFCbNY68MyxhvWH6zYqXp7ArSW084gqNMiSsHIHEm_ZBY8wAQBjRni2ngbRZ7c/s1600-h/image%25255B42%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh8XryRJN-CyFtSCQus73-vRztNOjZ_91WfARfHrhJ_yBZiiznUDWIv7rocPHZwsQh76YDs__YrjNsRyIjt6WNRCes4tnZOWmkf-eOFixxmhyphenhyphenl_KprlZ-PBVTbnkVAbQDzf48pz30w0IUg/?imgmax=800&quot; height=&quot;259&quot; style=&quot;background-image: none; border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; title=&quot;image&quot; width=&quot;335&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;h1 align=&quot;center&quot;&gt;
【要怎么保存project？】&lt;/h1&gt;
&lt;div align=&quot;left&quot;&gt;
你可以到File &amp;gt; Save xxx.cs来保存当前编辑着的文件，或者是按下Ctrl + S&lt;/div&gt;
&lt;div align=&quot;left&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEibK85sf6tVLuoBlHKQs_05XFm8hrl1khaSP9Kq1uz1ljtMpEaLgCruv7tmEW44nixumRsxjLkIpOlfNgmqBubhHwP4P1HvUeotexmLIoh0Wc1USN_HDXqIikGS42cVoG-Ctcc-5oJpWPm3/s1600-h/image%25255B45%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj0JyjWNuCtz_r2fMbw5i2mUAOIBsRY9E-ys47AX1GS-5dOndWVpWXVk2FOdWDURz6V4G10JaBqnZSCsIm5Rpq-Dsm8wpFVE32g6W6XAgiOqaMED_7jyOt4jBMcITZnPVagGmChLLuvcv7l/?imgmax=800&quot; height=&quot;417&quot; style=&quot;background-image: none; border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; title=&quot;image&quot; width=&quot;349&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div align=&quot;left&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div align=&quot;left&quot;&gt;
也可以点击Save All 来保存所有文件，或者是按下Ctrl + Shift + S&lt;/div&gt;
&lt;div align=&quot;left&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiB0tBmwI48YNRGUPSUl8Ir-zKxmo5roIUEQPhyphenhypheng1Ox9PTObXsl2MQA3c-4C_yzSN9s5DokfvU_hqTj3xv_pDnA8BwXDo70b-X8GTly4kgVeA7HNh5MXn_oGtIXB0Wxp17Ie92Vg52g3r0/s1600-h/image%25255B48%25255D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjQKZP8DQqnmIol7hD8Sxn9RfTCuYwlxdYmehSURpy5HdxW83xRVLF6a1yGmsiIwOpSk2J5MOnPyUys_Sp_RUXbOl0rcPTtMM93rbVb4VDZirUyxP4GcJcPnvJI5X39-dII5-3ArE8KPg7s/?imgmax=800&quot; height=&quot;415&quot; style=&quot;background-image: none; border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; title=&quot;image&quot; width=&quot;350&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;blogger-post-footer&quot;&gt;&lt;script&gt;
SyntaxHighlighter.highlight();
var linkwithin_site_id = 1130633;
$(&#39;#toTop&#39;).remove();
$(&#39;body&#39;).append(&#39;&lt;div id=&quot;toTop&quot; onclick=&quot;$(\&#39;html,body\&#39;).stop().animate({\&#39;scrollTop\&#39;: 0})&quot;&gt;Top&lt;/div&gt;&#39;);
$(window).on(&#39;scroll&#39;,function(){
if ($(this).scrollTop())
{
$(&#39;#toTop&#39;).fadeIn(&#39;fast&#39;);
}
else
{
$(&#39;#toTop&#39;).fadeOut(&#39;fast&#39;);
}
});
&lt;/script&gt;
&lt;script src=&quot;http://www.linkwithin.com/widget.js&quot;&gt;&lt;/script&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://garyngzhongbo.blogspot.com/feeds/3992995756906081050/comments/default' title='博文评论'/><link rel='replies' type='text/html' href='http://garyngzhongbo.blogspot.com/2013/11/c-2visual-studio-2010.html#comment-form' title='0 条评论'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5319618319979683940/posts/default/3992995756906081050'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5319618319979683940/posts/default/3992995756906081050'/><link rel='alternate' type='text/html' href='http://garyngzhongbo.blogspot.com/2013/11/c-2visual-studio-2010.html' title='[教程][C#] 新手入门教程#2——初识Visual Studio 2010'/><author><name>Gary Ng</name><uri>http://www.blogger.com/profile/00014057672539539340</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjZCKwSsw8ET6hCVdDoBmPsg02Vvu93KoFydaIvENv3klzjnQW3W2AynY42cGGZulpo-q-E65WLAPVBBIuvvDMRq_AD8ssP3Dm5ruUU-U__IYkKA8UsYIpOeYyz2KG33Eo6y84-CRcRO14/s72-c?imgmax=800" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5319618319979683940.post-983253250079383220</id><published>2013-11-15T18:57:00.002+08:00</published><updated>2013-11-15T18:57:25.683+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="C#"/><category scheme="http://www.blogger.com/atom/ns#" term="入门"/><category scheme="http://www.blogger.com/atom/ns#" term="原创"/><category scheme="http://www.blogger.com/atom/ns#" term="教程"/><category scheme="http://www.blogger.com/atom/ns#" term="新手"/><title type='text'>[教程][C#] 新手入门教程#1——前言</title><content type='html'>&lt;h1 align=&quot;center&quot;&gt;
【写在前面的话】&lt;/h1&gt;
其实想写教程很久了，但是没有足够的功底，所以也不敢胡乱写一通。现在就整理一下思绪，一点一点的写。&lt;br /&gt;
&lt;br /&gt;
如果你不懂什么是C#，或者完全没有接触过任何编程语言，这个教程写给你的，但是你得知道怎么好好的操作电脑，比如按装程序、卸载等等，如果你不熟悉的话，那，对不起，这个教程基本上不适合你（当然你还可以看，但是你得花很多时间慢慢消化）。&lt;br /&gt;
&lt;br /&gt;
如果教程中有什么错误等等，请大胆指出（当然别骂粗话..），我会尽快更改的。&lt;br /&gt;
&lt;br /&gt;
&lt;h1 align=&quot;center&quot;&gt;
【什么是C#？】&lt;/h1&gt;
恩..C# 是Microsoft （别告诉我你连微软都不知道是啥..）基于.net 框架开发的语言，这代表如果你要运行C#程序，你得安装.net framework，而且C#不是跨平台的语言，这代表你不能在Linux或者是Mac 上面运行你的C# 程序。&lt;br /&gt;
（当然有一个开源的.net 框架叫做Mono，他能跨平台运行.net程序，但是，我不会写关于mono的教程，因为，我也不会用..）&lt;br /&gt;
&lt;br /&gt;
&lt;h1 align=&quot;center&quot;&gt;
【C#怎么发音？】&lt;/h1&gt;
这..C#呢，不是读c hash，而是c sharp，为什么？别问我问Microsoft!&lt;br /&gt;
&lt;br /&gt;
不过C# 其实不是写作C#，而是C♯，但是因为太难打了，键盘上也没有这个符号（这符号是我去Google回来的），所以就标准化将♯写成#，所以呢，C#就这样来了！&lt;br /&gt;
&lt;img alt=&quot;File:C Sharp wordmark.svg&quot; border=&quot;0&quot; height=&quot;318&quot; src=&quot;http://upload.wikimedia.org/wikipedia/commons/thumb/0/0d/C_Sharp_wordmark.svg/464px-C_Sharp_wordmark.svg.png&quot; style=&quot;background-image: none; border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; width=&quot;464&quot; /&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;h1 align=&quot;center&quot;&gt;
【怎么写C#程序？】&lt;/h1&gt;
哈哈，问到重点了！写程序呢，要有一个编辑器、编译器，或者说——IDE，有很多IDE（别写成DIE了！）支援.net开发，比如说SharpDevelop，还有之前说过的Mono，当然，你可以下载试用他们，因为他们都是免费的、开源的。&lt;br /&gt;
&lt;br /&gt;
但是我建议你们使用Microsoft 的 Visual Studio ，有Express 版本是免费的，只要你有Hotmail，你就可以免费获取激活Visual Studio的序列号，当然Visual Studio 还有Pro，Ultimate版本的，但是都是收费的（Microsoft 开发的嘛，你知道的）。&lt;br /&gt;
&lt;br /&gt;
这个教程中，我会Microsoft Visual Studio 2010 版本的，所以你也得下载2010版本的（其实2012、2013也可以的..），你可以来这边下载Visual Studio 2010 Express(&lt;a href=&quot;http://www.microsoft.com/visualstudio/eng/downloads#d-2010-express&quot; title=&quot;http://www.microsoft.com/visualstudio/eng/downloads#d-2010-express&quot;&gt;http://www.microsoft.com/visualstudio/eng/downloads#d-2010-express&lt;/a&gt;)，你可以选择只下载C#的，或者是All in one的，你还得注册获取序列号。&lt;br /&gt;
&lt;br /&gt;
如果你不喜欢Express呢（或者你觉得Express这个字眼代表了N的功能被阉割）？嘿嘿，用Ultimate 版本的吧！&lt;br /&gt;
我之前发过一篇文章&lt;a href=&quot;http://garyngzhongbo.blogspot.com/2013/06/vsvisual-studio-2010-2012.html&quot; target=&quot;_blank&quot;&gt;——【分享】【VS】Visual Studio 2010 + 2012 下载地址&lt;/a&gt; 里面有VS2010 和 2012 的torrent下载链接，在那儿下载、安装（别说你不懂怎么安装..），一切就准备好了！   &lt;div class=&quot;blogger-post-footer&quot;&gt;&lt;script&gt;
SyntaxHighlighter.highlight();
var linkwithin_site_id = 1130633;
$(&#39;#toTop&#39;).remove();
$(&#39;body&#39;).append(&#39;&lt;div id=&quot;toTop&quot; onclick=&quot;$(\&#39;html,body\&#39;).stop().animate({\&#39;scrollTop\&#39;: 0})&quot;&gt;Top&lt;/div&gt;&#39;);
$(window).on(&#39;scroll&#39;,function(){
if ($(this).scrollTop())
{
$(&#39;#toTop&#39;).fadeIn(&#39;fast&#39;);
}
else
{
$(&#39;#toTop&#39;).fadeOut(&#39;fast&#39;);
}
});
&lt;/script&gt;
&lt;script src=&quot;http://www.linkwithin.com/widget.js&quot;&gt;&lt;/script&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://garyngzhongbo.blogspot.com/feeds/983253250079383220/comments/default' title='博文评论'/><link rel='replies' type='text/html' href='http://garyngzhongbo.blogspot.com/2013/11/c-1.html#comment-form' title='3 条评论'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5319618319979683940/posts/default/983253250079383220'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5319618319979683940/posts/default/983253250079383220'/><link rel='alternate' type='text/html' href='http://garyngzhongbo.blogspot.com/2013/11/c-1.html' title='[教程][C#] 新手入门教程#1——前言'/><author><name>Gary Ng</name><uri>http://www.blogger.com/profile/00014057672539539340</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>3</thr:total></entry></feed>