﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>语源科技BlogJava-梦想不只是做梦想一想</title><link>http://www.blogjava.net/cookie731/</link><description>青青子衿, 悠悠我心, 但为君故, 沉吟至今
</description><language>zh-cn</language><lastBuildDate>Wed, 06 May 2026 23:12:49 GMT</lastBuildDate><pubDate>Wed, 06 May 2026 23:12:49 GMT</pubDate><ttl>60</ttl><item><title>C#String与string大小写的区别  </title><link>http://www.blogjava.net/cookie731/articles/398201.html</link><dc:creator>梦想不只是做梦想一想</dc:creator><author>梦想不只是做梦想一想</author><pubDate>Mon, 22 Apr 2013 06:11:00 GMT</pubDate><guid>http://www.blogjava.net/cookie731/articles/398201.html</guid><wfw:comment>http://www.blogjava.net/cookie731/comments/398201.html</wfw:comment><comments>http://www.blogjava.net/cookie731/articles/398201.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/cookie731/comments/commentRss/398201.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/cookie731/services/trackbacks/398201.html</trackback:ping><description><![CDATA[<h3 class="title pre fs1" align="center"><span class="tcnt"><font size="5" face="微软雅黑">C#String与string大小写的区别</font></span>&nbsp;&nbsp;<span class="bgc0 fc07 fw0 fs0"></span></h3>
<div></div>
<div class="nbw-blog-start"></div>
<div class="bct fc05 fc11 nbw-blog ztag js-fs2" __1366610798386__="ev_2692243247"><font color="#333333" size="3">
<p>1.string是c#中的类，String是.net Framework的类(在c# IDE中不会显示蓝色) ;</p>
<p>2.c# string映射为.net Framework的String ;</p>
<p>3.如果用string,编译器会把它编译成String，所以如果直接用String就可以让编译器少做一点点工作 ;</p>
<p>4.如果使用c#，建议使用string，比较符合规范 ;&nbsp; </p>
<p>5.string始终代表 System.String(1.x) 或 ::System.String(2.0) ;</p>
<p>6.String只有在前面有using System;的时候并且当前命名空间中没有名为String的类型（class、struct、delegate、enum）的时候才代表System.String ;</p>
<p>7.string是关键字，String不是，也就是说string不能作为类、结构、枚举、字段、变量、方法、属性的名称，而String可以 ;</p>
<p></font>&nbsp;</p></div><img src ="http://www.blogjava.net/cookie731/aggbug/398201.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/cookie731/" target="_blank">梦想不只是做梦想一想</a> 2013-04-22 14:11 <a href="http://www.blogjava.net/cookie731/articles/398201.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>C#中partial关键字 </title><link>http://www.blogjava.net/cookie731/articles/398065.html</link><dc:creator>梦想不只是做梦想一想</dc:creator><author>梦想不只是做梦想一想</author><pubDate>Fri, 19 Apr 2013 01:25:00 GMT</pubDate><guid>http://www.blogjava.net/cookie731/articles/398065.html</guid><wfw:comment>http://www.blogjava.net/cookie731/comments/398065.html</wfw:comment><comments>http://www.blogjava.net/cookie731/articles/398065.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/cookie731/comments/commentRss/398065.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/cookie731/services/trackbacks/398065.html</trackback:ping><description><![CDATA[<div class="clear"></div>
<div class="postBody">
<div id="cnblogs_post_body">
<p align="left"><strong>1. </strong><strong>什么是局部类型？</strong><strong><br /><br /></strong>C# 2.0 引入了局部类型的概念。局部类型允许我们将一个类、结构或接口分成几个部分，分别实现在几个不同的.cs文件中。<br /><br />局部类型适用于以下情况：<br /><br />(1) 类型特别大，不宜放在一个文件中实现。<br />(2) 一个类型中的一部分代码为自动化工具生成的代码，不宜与我们自己编写的代码混合在一起。<br />(3) 需要多人合作编写一个类。<br /><br />局部类型是一个纯语言层的编译处理，不影响任何执行机制&#8212;&#8212;事实上C#编译器在编译的时候仍会将各个部分的局部类型合并成一个完整的类。</p>
<p align="left">&nbsp;&nbsp; public partial class Program<br />&nbsp;&nbsp; {<br />&nbsp;&nbsp;&nbsp;&nbsp; static void Main(string[] args)<br />&nbsp;&nbsp;&nbsp;&nbsp; {<br />&nbsp;&nbsp;&nbsp;&nbsp; }<br />&nbsp;&nbsp; }<br /><br />&nbsp;&nbsp; partial class Program<br />&nbsp;&nbsp; {&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp; public void Test()<br />&nbsp;&nbsp;&nbsp;&nbsp; {&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp; }<br />&nbsp;&nbsp; }</p>
<p align="left"><br /><strong>2. </strong><strong>局部类型的限制</strong><br /><br />(1) 局部类型只适用于类、接口、结构，不支持委托和枚举。<br />(2) 同一个类型的各个部分必须都有修饰符 partial。<br />(3) 使用局部类型时，一个类型的各个部分必须位于相同的命名空间中。<br />(4) 一个类型的各个部分必须被同时编译。<br /><br /><strong>3. </strong><strong>局部类型的注意点</strong><br /><br />(1) 关键字partial是一个上下文关键字，只有和 class、struct、interface 放在一起时才有关键字的含义。因此partial的引入不会影响现有代码中名称为partial的变量。<br />(2) 局部类型的各个部分一般是分开放在几个不同的.cs文件中，但C#编译器允许我们将他们放在同一文件中。<br /><br /><strong>4. </strong><strong>局部类型的应用特性</strong><br /><br />在局部类型上的特性具有&#8220;累加&#8221;效应。</p>
<p align="left">[Attribute1, Attribute2("Hello")]<br />partial class Class1{}<br /><br />[Attribute3, Attribute2("Exit")]<br />partial class Class1{}</p>
<p align="left"><br />相当于</p>
<p align="left">[Attribute1, Attribute2("Hello"), Attribute3, Attribute2("Exit")]<br />class Class1 {}</p>
<p align="left"><br />注：Attribute2属性允许在类上多次使用。<br /><br /><strong>5. </strong><strong>局部类型上的修饰符</strong><br /><br />(1) 一个类型的各个部分上的访问修饰符必须维持一致性。<br />(2) 如果一个类型有一个部分使用了abstract修饰符，那么整个类都将被视为抽象类。<br />(3) 如果一个类型有一个部分使用了 sealed 修饰符，那么整个类都将被视为密封类。<br />(4) 一个类的各个部分不能使用相互矛盾的修饰符，比如不能在一个部分上使用abstract，又在另一个部分上使用sealed。<br /><br /><strong>6. </strong><strong>局部类型的基类和接口</strong><br /><br />(1) 一个类型的各个部分上指定的基类必须一致。某个部分可以不指定基类，但如果指定，则必须相同。<br />(2) 局部类型上的接口具有&#8220;累加&#8221;效应。</p>
<p align="left">partial class Class2: Iinterface1, Iinterface2 {}<br />partial class Class2: Iinterface3 {}<br />partial class Class2: Iinterface2 {}</p>
<p align="left"><br />相当于</p>
<p align="left">class Class2: Iinterface1, Iinterface2, Iinterface3 {}</p></div></div><img src ="http://www.blogjava.net/cookie731/aggbug/398065.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/cookie731/" target="_blank">梦想不只是做梦想一想</a> 2013-04-19 09:25 <a href="http://www.blogjava.net/cookie731/articles/398065.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>使用foreach语句来进行循环操作</title><link>http://www.blogjava.net/cookie731/articles/397923.html</link><dc:creator>梦想不只是做梦想一想</dc:creator><author>梦想不只是做梦想一想</author><pubDate>Tue, 16 Apr 2013 08:21:00 GMT</pubDate><guid>http://www.blogjava.net/cookie731/articles/397923.html</guid><wfw:comment>http://www.blogjava.net/cookie731/comments/397923.html</wfw:comment><comments>http://www.blogjava.net/cookie731/articles/397923.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/cookie731/comments/commentRss/397923.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/cookie731/services/trackbacks/397923.html</trackback:ping><description><![CDATA[<div>
<p style="text-indent: 21pt"><span style="font-family: 宋体"><br /><a href="http://blog.csdn.net/guolei0451/article/details/1301884">http://blog.csdn.net/guolei0451/article/details/1301884</a><br /><br />&nbsp;&nbsp; 循环语句是编程的基本语句，在</span>C#<span style="font-family: 宋体">中除了沿用</span>C<span style="font-family: 宋体">语言的循环语句外，还提供了</span>foreach<span style="font-family: 宋体">语句来实现循环。那么我要说的就是，在循环操作中尽量使用</span>foreach<span style="font-family: 宋体">语句来实现。</span><span style="font-family: 宋体">为了来更好地说明为什么要提倡使用</span>foreach<span style="font-family: 宋体">，用如下三种不同方式来编写循环语句。</span></p>
<p align="left"><span style="font-family: 新宋体; font-size: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: blue">int</span>[] nArray = <span style="color: blue">new</span> <span style="color: blue">int</span>[100];</span></p>
<p align="left">&nbsp;</p>
<p align="left"><span style="font-family: 新宋体; font-size: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: green">// Use "foreach" to loop array</span></span></p>
<p align="left"><span style="font-family: 新宋体; font-size: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: blue">foreach</span>( <span style="color: blue">int</span> i <span style="color: blue">in</span> nArray )</span></p>
<p align="left"><span style="font-family: 新宋体; font-size: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Debug.WriteLine( i.ToString() );</span></p>
<p align="left">&nbsp;</p>
<p align="left"><span style="font-family: 新宋体; font-size: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: green">// Use "for" to loop array</span></span></p>
<p align="left"><span style="font-family: 新宋体; font-size: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: blue">for</span>( <span style="color: blue">int</span> i = 0; i &lt; nArray.Length; i++ )</span></p>
<p align="left"><span style="font-family: 新宋体; font-size: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Debug.WriteLine( nArray[i].ToString() );</span></p>
<p align="left">&nbsp;</p>
<p align="left"><span style="font-family: 新宋体; font-size: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: green">// Another way using "for" to loop array</span></span></p>
<p align="left"><span style="font-family: 新宋体; font-size: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: blue">int</span> nLength = nArray.Length;</span></p>
<p align="left"><span style="font-family: 新宋体; font-size: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: blue">for</span>( <span style="color: blue">int</span> i = 0; i &lt; nLength; i++ )</span></p>
<p align="left"><span style="font-family: 新宋体; font-size: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Debug.WriteLine( nArray[i].ToString() );</span></p>
<p>&nbsp;</p>
<p style="text-indent: 21pt"><strong><em><span style="font-family: 宋体; color: #339966">很明显，</span><span style="color: #339966">foreach</span></em></strong><strong><em><span style="font-family: 宋体; color: #339966">语句很简洁，但是它的优点不仅仅在于此，它的效率也是最高的。</span></em></strong><em><span style="font-family: 宋体; color: #ff9900">可能很多人认为最后一种的效率会更高，因为表面上看着不用每次访问引用类型的属性。可是它却是三者当中，效率最低的。因为</span><span style="color: #ff9900">C#</span></em><em><span style="font-family: 宋体; color: #ff9900">是强类型检查，那么对于数组访问的时候，要对索引的有效值进行判断，那么对于最后一种代码实际产生的效果如同下面的代码一样。</span></em></p>
<p align="left"><span style="font-family: 新宋体; font-size: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: green">// Another way using "for" to loop array</span></span></p>
<p align="left"><span style="font-family: 新宋体; font-size: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: blue">int</span> nLength = nArray.Length;</span></p>
<p align="left"><span style="font-family: 新宋体; font-size: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: blue">for</span>( <span style="color: blue">int</span> i = 0; i &lt; nLength; i++ )</span></p>
<p align="left"><span style="font-family: 新宋体; font-size: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {</span></p>
<p align="left"><span style="font-family: 新宋体; font-size: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: blue">if</span>( i &lt; nArray.Length )</span></p>
<p align="left"><span style="font-family: 新宋体; font-size: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Debug.WriteLine( nArray[i].ToString() );</span></p>
<p align="left"><span style="font-family: 新宋体; font-size: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: blue">else</span></span></p>
<p align="left"><span style="font-family: 新宋体; font-size: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: blue">throw</span> <span style="color: blue">new</span> IndexOutOfRangeException();</span></p>
<p align="left"><span style="font-family: 新宋体; font-size: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</span></p>
<p style="text-indent: 21pt"><strong><span style="font-family: 黑体; color: red">（书中这里有些出入，经过网友</span></strong><strong><span style="font-family: 黑体; color: red; font-size: 15pt">sozdream</span></strong><strong><span style="font-family: 黑体; color: red">的提示，在1.1环境下发现最后一种方法是最快的，前两者的速度基本相等；通过Dissambly查看最后一种循环方法所产生的代码，并没有产生类似于文章所说的那种索引检查。不过还是不建议使用最后一种，因为此方法对索引的判断有些脱节，尤其是当循环中数组尺寸发生变化的时候，索引有效检查无法及时进行）</span></strong></p>
<p style="text-indent: 21pt">&nbsp;</p>
<p style="text-indent: 21pt">foreach<span style="font-family: 宋体">语句除了简洁和高效外，还有很多优点，接下来一一列举。</span></p>
<p style="text-indent: 21pt">&nbsp;</p>
<p style="text-indent: 21pt"><strong><em><span style="font-family: 宋体; color: #339966">第一个就是不用考虑数组起始索引是几，很多人可能从其他语言转到</span><span style="color: #339966">C#</span></em></strong><strong><em><span style="font-family: 宋体; color: #339966">的，那么原先语言的起始索引可能不是</span><span style="color: #339966">1</span></em></strong><strong><em><span style="font-family: 宋体; color: #339966">，例如</span><span style="color: #339966">VB</span></em></strong><strong><em><span style="font-family: 宋体; color: #339966">或者</span><span style="color: #339966">Delphi</span></em></strong><strong><em><span style="font-family: 宋体; color: #339966">语言，那么在</span><span style="color: #339966">C#</span></em></strong><strong><em><span style="font-family: 宋体; color: #339966">中使用数组的时候就难免疑问到底使用</span><span style="color: #339966">0</span></em></strong><strong><em><span style="font-family: 宋体; color: #339966">开始还是用</span><span style="color: #339966">1</span></em></strong><strong><em><span style="font-family: 宋体; color: #339966">开始呢，那么使用</span><span style="color: #339966">foreach</span></em></strong><strong><em><span style="font-family: 宋体; color: #339966">就可以避免这类问题。</span></em></strong></p>
<p style="text-indent: 21pt">&nbsp;</p>
<p style="text-indent: 21pt"><strong><em><span style="font-family: 宋体; color: #339966">第二个好处就是对于多维数组操作用</span><span style="color: #339966">foreach</span></em></strong><strong><em><span style="font-family: 宋体; color: #339966">就非常简便了</span></em></strong><span style="font-family: 宋体">，例如：</span></p>
<p align="left"><span style="font-family: 新宋体; font-size: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: blue">int</span>[,] nVisited = <span style="color: blue">new</span> <span style="color: blue">int</span>[8,8];</span></p>
<p align="left"><span style="font-family: 新宋体; font-size: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: green">// Use "for" to loop two-dimension array</span></span></p>
<p align="left"><span style="font-family: 新宋体; font-size: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: blue">for</span>( <span style="color: blue">int</span> i = 0; i &lt; nVisited.GetLength(0); i++ )</span></p>
<p align="left"><span style="font-family: 新宋体; font-size: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: blue">for</span>( <span style="color: blue">int</span> j = 0; j &lt; nVisited.GetLength( 1 ); j++ )</span></p>
<p align="left"><span style="font-family: 新宋体; font-size: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Debug.WriteLine( nVisited[i,j].ToString() );</span></p>
<p align="left">&nbsp;</p>
<p align="left"><span style="font-family: 新宋体; font-size: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: green">// Use "foreach" to loop two-dimension array</span></span></p>
<p align="left"><span style="font-family: 新宋体; font-size: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: blue">foreach</span>( <span style="color: blue">int</span> i <span style="color: blue">in</span> nVisited )</span></p>
<p align="left"><span style="font-family: 新宋体; font-size: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Debug.WriteLine( i.ToString() );</span></p>
<p style="text-indent: 21pt">&nbsp;</p>
<p style="text-indent: 21pt"><span style="font-family: 宋体">对于三维或更多维，</span>foreach<span style="font-family: 宋体">语句不用发生任何变化，而对于</span>for<span style="font-family: 宋体">语句来说就要进行修改了，这里就不多说了。</span></p>
<p style="text-indent: 21pt">&nbsp;</p>
<p style="text-indent: 21pt"><strong><em><span style="font-family: 宋体; color: #339966">第三个要说的就是</span><span style="color: #339966">foreach</span></em></strong><strong><em><span style="font-family: 宋体; color: #339966">完成类型转换操作，这种体现可能通过如上的例子看不出任何效果，但是对于</span><span style="color: #339966">ArrayList</span></em></strong><strong><em><span style="font-family: 宋体; color: #339966">之类的数据集来说，这种操作就显得比较突出</span></em></strong><span style="font-family: 宋体">，例如：</span></p>
<p align="left"><span style="font-family: 新宋体; font-size: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: green">// Init an arraylist object</span></span></p>
<p align="left"><span style="font-family: 新宋体; font-size: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: blue">int</span>[] nArray = <span style="color: blue">new</span> <span style="color: blue">int</span>[100];</span></p>
<p align="left"><span style="font-family: 新宋体; font-size: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ArrayList arrInt = <span style="color: blue">new</span> ArrayList();</span></p>
<p align="left"><span style="font-family: 新宋体; font-size: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; arrInt.AddRange( nArray );</span></p>
<p align="left">&nbsp;</p>
<p align="left"><span style="font-family: 新宋体; font-size: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: green">// Use "foreach" to loop an arraylist</span></span></p>
<p align="left"><span style="font-family: 新宋体; font-size: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: blue">foreach</span>( <span style="color: blue">int</span> i <span style="color: blue">in</span> arrInt )</span></p>
<p align="left"><span style="font-family: 新宋体; font-size: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Debug.WriteLine( i.ToString() );</span></p>
<p align="left">&nbsp;</p>
<p align="left"><span style="font-family: 新宋体; font-size: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: green">// Use "for" to loop an arraylist</span></span></p>
<p align="left"><span style="font-family: 新宋体; font-size: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: blue">for</span>( <span style="color: blue">int</span> i = 0; i &lt; arrInt.Count; i++ )</span></p>
<p align="left"><span style="font-family: 新宋体; font-size: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {</span></p>
<p align="left"><span style="font-family: 新宋体; font-size: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: blue">int</span> n = ( <span style="color: blue">int</span> ) arrInt[i];</span></p>
<p align="left"><span style="font-family: 新宋体; font-size: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Debug.WriteLine( n.ToString() );</span></p>
<p align="left"><span style="font-family: 新宋体; font-size: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</span></p>
<p style="text-indent: 21pt">&nbsp;</p>
<p style="text-indent: 21pt"><strong><em><span style="font-family: 宋体; color: #339966">最后要说的是使用</span><span style="color: #339966">foreach</span></em></strong><strong><em><span style="font-family: 宋体; color: #339966">并没有增加资源使用，这句话听得有些难懂，由于对于继承了</span><span style="color: #339966">IEnumerable</span></em></strong><strong><em><span style="font-family: 宋体; color: #339966">接口的类型数据，才能使用</span><span style="color: #339966">foreach</span></em></strong><strong><em><span style="font-family: 宋体; color: #339966">语句，那么对于使用</span><span style="color: #339966">foreach</span></em></strong><strong><em><span style="font-family: 宋体; color: #339966">会访问</span><span style="color: #339966">IEnumerable</span></em></strong><strong><em><span style="font-family: 宋体; color: #339966">接口中</span><span style="color: #339966">GetEnumerator</span></em></strong><strong><em><span style="font-family: 宋体; color: #339966">方法来进行枚举</span></em></strong><span style="font-family: 宋体">，那么对于如上的</span>foreach<span style="font-family: 宋体">语句，对应的语句其实如下：</span></p>
<p align="left"><span style="font-family: 新宋体; font-size: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; IEnumerator it = arrInt.GetEnumerator() <span style="color: blue">as</span> IEnumerator;</span></p>
<p align="left"><span style="font-family: 新宋体; font-size: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: blue">using</span>( IDisposable disp = it <span style="color: blue">as</span> IDisposable )</span></p>
<p align="left"><span style="font-family: 新宋体; font-size: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {</span></p>
<p align="left"><span style="font-family: 新宋体; font-size: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: blue">while</span>( it.MoveNext() )</span></p>
<p align="left"><span style="font-family: 新宋体; font-size: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {</span></p>
<p align="left"><span style="font-family: 新宋体; font-size: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: blue">int</span> elem = ( <span style="color: blue">int</span> )it.Current;</span></p>
<p align="left"><span style="font-family: 新宋体; font-size: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Debug.WriteLine( elem.ToString() );</span></p>
<p align="left"><span style="font-family: 新宋体; font-size: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</span></p>
<p align="left"><span style="font-family: 新宋体; font-size: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</span></p>
<p style="text-indent: 21pt">&nbsp;</p>
<p style="text-indent: 21pt"><strong><em><span style="font-family: 宋体; color: #339966">也就是说在出了</span><span style="color: #339966">foreach</span></em></strong><strong><em><span style="font-family: 宋体; color: #339966">之后对于</span><span style="color: #339966">IEnumerator</span></em></strong><strong><em><span style="font-family: 宋体; color: #339966">的对象也进行</span><span style="color: #339966">Dispose</span></em></strong><strong><em><span style="font-family: 宋体; color: #339966">处理。</span></em></strong></p>
<p style="text-indent: 21pt">&nbsp;</p>
<p style="text-indent: 21pt"><span style="font-family: 宋体">对于</span>foreach<span style="font-family: 宋体">说了这么多好处，那么在使用它是否可以无懈可击呢。其实不是这样的，<strong><em><span style="color: red">在</span></em></strong></span><strong><em><span style="color: red">foreach</span></em></strong><strong><em><span style="font-family: 宋体; color: red">语句中有两个限制，第一不能修改枚举成员，其次不要对集合进行删除操作。</span></em></strong><span style="font-family: 宋体; color: black">也就是如下两种方式都是错误的。</span></p>
<p align="left"><span style="font-family: 新宋体; font-size: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: green">// Use "foreach" to loop an arraylist</span></span></p>
<p align="left"><span style="font-family: 新宋体; font-size: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: blue">foreach</span>( <span style="color: blue">int</span> i <span style="color: blue">in</span> arrInt )</span></p>
<p align="left"><span style="font-family: 新宋体; font-size: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {</span></p>
<p align="left"><span style="font-family: 新宋体; font-size: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; i++;<span style="color: green">//Can't be compiled</span></span></p>
<p align="left"><span style="font-family: 新宋体; font-size: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Debug.WriteLine( i.ToString() );</span></p>
<p align="left"><span style="font-family: 新宋体; font-size: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</span></p>
<p>&nbsp;</p>
<p align="left"><span style="font-family: 新宋体; font-size: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: green">// Use "foreach" to loop an arraylist</span></span></p>
<p align="left"><span style="font-family: 新宋体; font-size: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: blue">foreach</span>( <span style="color: blue">int</span> i <span style="color: blue">in</span> arrInt )</span></p>
<p align="left"><span style="font-family: 新宋体; font-size: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {</span></p>
<p align="left"><span style="font-family: 新宋体; font-size: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; arrInt.Remove( i );<span style="color: green">//It will generate error in run-time</span></span></p>
<p align="left"><span style="font-family: 新宋体; font-size: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Debug.WriteLine( i.ToString() );</span></p>
<p align="left"><span style="font-family: 新宋体; font-size: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</span></p>
<p>&nbsp;</p>
<p style="text-indent: 21pt"><span style="font-family: 宋体">那么对于如上两个操作，可以用</span>for<span style="font-family: 宋体">来实现，此外这里多说一句，<strong><em><span style="color: red">就是对于一个记录集的多条数据删除问题，也是经常出现问题的地方（论坛上经常问类似的问题），由于在一些记录集中进行删除的时候，在删除操作之后相应的索引也发生了变化，这时候的删除要反过来进行删除，大致形式如下。</span></em></strong></span></p>
<p align="left"><span style="font-family: 新宋体; font-size: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: green">// Use "for" to loop an arraylist</span></span></p>
<p align="left"><span style="font-family: 新宋体; font-size: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: blue">for</span>( <span style="color: blue">int</span> i = arrInt.Count - 1; i &gt;=0; i-- )</span></p>
<p align="left"><span style="font-family: 新宋体; font-size: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {</span></p>
<p align="left"><span style="font-family: 新宋体; font-size: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: blue">int</span> n = ( <span style="color: blue">int</span> ) arrInt[i];</span></p>
<p align="left"><span style="font-family: 新宋体; font-size: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: blue">if</span>( n == 5 )</span></p>
<p align="left"><span style="font-family: 新宋体; font-size: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; arrInt.RemoveAt( i );<span style="color: green"> // Remove data here</span></span></p>
<p align="left"><span style="font-family: 新宋体; font-size: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Debug.WriteLine( n.ToString() );</span></p>
<p align="left"><span style="font-family: 新宋体; font-size: 10pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</span></p>
<p style="text-indent: 21pt">&nbsp;</p>
<p style="text-indent: 21pt"><em><span style="font-family: 宋体; color: #ff9900">除了这两个地方外，</span><span style="color: #ff9900">foreach</span></em><em><span style="font-family: 宋体; color: #ff9900">可以基本适用于任何循环，因此对于循环的编写要尽量使用</span><span style="color: #ff9900">foreach</span></em><em><span style="font-family: 宋体; color: #ff9900">，因为它会使你的代码清晰简洁，又不失高效。</span></em></p><br /><br />
<p id="TBPingURL">Trackback: http://tb.blog.csdn.net/TrackBack.aspx?PostId=1100236</p></div><img src ="http://www.blogjava.net/cookie731/aggbug/397923.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/cookie731/" target="_blank">梦想不只是做梦想一想</a> 2013-04-16 16:21 <a href="http://www.blogjava.net/cookie731/articles/397923.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>C# const和readonly的区别</title><link>http://www.blogjava.net/cookie731/articles/397915.html</link><dc:creator>梦想不只是做梦想一想</dc:creator><author>梦想不只是做梦想一想</author><pubDate>Tue, 16 Apr 2013 06:08:00 GMT</pubDate><guid>http://www.blogjava.net/cookie731/articles/397915.html</guid><wfw:comment>http://www.blogjava.net/cookie731/comments/397915.html</wfw:comment><comments>http://www.blogjava.net/cookie731/articles/397915.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/cookie731/comments/commentRss/397915.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/cookie731/services/trackbacks/397915.html</trackback:ping><description><![CDATA[<h1 class="postTitle"><a id="cb_post_title_url" class="postTitle2" href="http://www.cnblogs.com/jonescheng/archive/2008/05/09/1190049.html">C# const和readonly的区别<br /><br /><br /></a>
<div class="clear"></div></h1>
<div class="postBody">
<div id="cnblogs_post_body">
<p><br /><a href="http://www.cnblogs.com/jonescheng/archive/2008/05/09/1190049.html">http://www.cnblogs.com/jonescheng/archive/2008/05/09/1190049.html</a><br /><font color="#0000ff">const</font> 的概念就是一个包含不能修改的值的变量。<br />常数表达式是在编译时可被完全计算的表达式。因此不能从一个变量中提取的值来初始化常量。<br />如果 <font color="#800000">const int a = b+1;</font><font color="#0000ff">b</font>是一个变量，显然不能再编译时就计算出结果，所以常量是不可以用变量来初始化的。<br /><br /><br /><font color="#0000ff">readonly </font>允许把一个字段设置成常量，但可以执行一些运算，可以确定它的初始值。<br />因为 <font color="#0000ff">readonly</font> 是在计算时执行的，当然它可以用某些变量初始化。<br /><font color="#0000ff">readonly</font> 是实例成员，所以不同的实例可以有不同的常量值，这使readonly更灵活。<br /><br /><br /><strong><font color="#008000">readonly 关键字与 const 关键字不同。</font></strong><br /><br />1. <font color="#0000ff">const</font> 字段只能在该字段的声明中初始化。<br /><font color="#0000ff">&nbsp;&nbsp; readonly</font> 字段可以在声明或构造函数中初始化。因此，根据所使用的构造函数，readonly 字段可能具有不同的值。<br />2. <font color="#0000ff">const</font> 字段是编译时常数，而 <font color="#0000ff">readonly</font> 字段可用于运行时常数。<br />3. <font color="#0000ff">const</font> 默认就是静态的，而 <font color="#0000ff">readonly</font> 如果设置成静态的就必须显示声明。<br />4．<font color="#0000ff">const</font> 对于引用类型的常数，可能的值只能是 <font color="#0000ff">string</font> 和 <font color="#0000ff">null</font>。<br /><font color="#0000ff">&nbsp;&nbsp;&nbsp;&nbsp; readonly</font>可以是任何类型<br /><br /><strong><font color="#ff0000">* </font></strong>需要注意的一个问题是：</p>
<p>对于一个 <font color="#0000ff">readonly</font> 的 <font color="#0000ff">Reference</font> 类型，只是被限定不能进行赋值（写）操作而已。而对其成员的读写仍然是不受限制的。 <br /><br /><font color="#800000">public static readonly Class1 my = new Class1();<br />&#8230;<br />my.SomeProperty = 10;</font><font color="#808080"> </font>//正常<br /><font color="#800000">my = new Class1();</font> //出错，该对象是只读的<br /><br />但是，如果上例中的 <font color="#0000ff">Class1</font> 不是一个 <font color="#0000ff">Class</font> 而是一个 <font color="#0000ff">struct</font>，那么后面的两个语句就都会出错。<br /><br /><font color="#0000ff"><strong>static readonly</strong></font>:<br /><br />Java 中 <font color="#0000ff">static</font> 是当载入一个类时执行一次的。<br /><br />C#中是怎么执行的，我没有查到。很奇怪几乎每本java的书都会说static的问题，C#的往往只说怎么用，但是应该是在main函数调用之前初始化，所以<font color="#0000ff">static readonly</font>也是运行时的，可以用变量付值，如：<br /><br /><font color="#800000">private static readonly string path = System.Windows.Forms.Application.StartupPath + &#8220;aaa&#8221;;</font></p></div>
<div id="MySignature"></div>
<div class="clear"></div>
<div id="blog_post_info_block">
<div id="blog_post_info">&nbsp;</div></div></div><img src ="http://www.blogjava.net/cookie731/aggbug/397915.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/cookie731/" target="_blank">梦想不只是做梦想一想</a> 2013-04-16 14:08 <a href="http://www.blogjava.net/cookie731/articles/397915.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>C# var和dynamic的区别 </title><link>http://www.blogjava.net/cookie731/articles/397913.html</link><dc:creator>梦想不只是做梦想一想</dc:creator><author>梦想不只是做梦想一想</author><pubDate>Tue, 16 Apr 2013 05:59:00 GMT</pubDate><guid>http://www.blogjava.net/cookie731/articles/397913.html</guid><wfw:comment>http://www.blogjava.net/cookie731/comments/397913.html</wfw:comment><comments>http://www.blogjava.net/cookie731/articles/397913.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/cookie731/comments/commentRss/397913.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/cookie731/services/trackbacks/397913.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var表示&#8220;变量的类型是在编译时决定的&#8221;，但是dynamic表示&#8220;变量的类型是在运行时决定的&#8221;。因此，dynamic与var具有截然不同的含义。 
<p>　　var让你在初始化变量时少输入一些字，编译器会根据右值来推断出变量的类型。dynamic更厉害，它告诉编译器，根本就别理究竟是啥类型，运行时再推断不迟。</p>
<p>　　&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; var只能用于局部变量的定义，你不能把类的属性定义成 var，也不能把方法的返回值类型或者是参数类型定义成var。dynamic就没有这些局限了。</p>
<p>　　dynamic类型并没有跳过类型校验，只是延迟到了运行时。如果在运行时，检测到类型不兼容，照样会抛出异常。</p>
<p>　　&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 你可能在以下情况下使用dynamic：</p>
<p>　&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 　1.COM对象</p>
<p>　&nbsp;&nbsp; 　&nbsp;&nbsp;&nbsp;&nbsp; 2.动态语言(如IronPython，IronRuby等)对象</p>
<p>　　&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; 3.反射对象</p>
<p>　　&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;4.C# 4.0中动态创建的对象</p> <img src ="http://www.blogjava.net/cookie731/aggbug/397913.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/cookie731/" target="_blank">梦想不只是做梦想一想</a> 2013-04-16 13:59 <a href="http://www.blogjava.net/cookie731/articles/397913.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>C# 全局变量的实现--采用全局静态类</title><link>http://www.blogjava.net/cookie731/articles/397905.html</link><dc:creator>梦想不只是做梦想一想</dc:creator><author>梦想不只是做梦想一想</author><pubDate>Tue, 16 Apr 2013 05:19:00 GMT</pubDate><guid>http://www.blogjava.net/cookie731/articles/397905.html</guid><wfw:comment>http://www.blogjava.net/cookie731/comments/397905.html</wfw:comment><comments>http://www.blogjava.net/cookie731/articles/397905.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/cookie731/comments/commentRss/397905.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/cookie731/services/trackbacks/397905.html</trackback:ping><description><![CDATA[<h2 id="t_48a45b950100j68j" class="titName SG_txta" align="center">C#&nbsp;全局变量的实现</h2>
<p class="articalContent  ">&nbsp;<wbr>&nbsp;<wbr>&nbsp;<wbr> C# 应用程序中，如果要记录登陆用户的用户名、用户等级、用户IP地址等等，或者要记录应用程序的异常情况(如应用程序所在主机无法联网，我们必须把这一状态记录下来以备后续处理；又如应用程序抛出某个路径无法找到的异常，提醒用户进行重新配置，如果用户选择忽略该异常，那么后面再碰到该异常时，应用程序应该直接忽略而不是频繁地提醒用户)，这时，我们需要使用到全局变量。就跟ASP网站中登陆后使用SESSION,COOKIE的原理是一样的。</p>
<p class="articalContent  ">&nbsp;<wbr>&nbsp;<wbr>&nbsp;<wbr> 在C/C++中，全局变量是一种可以在程序任何位置上都可以使用的变量，那么C#中有没有类似的全局变量呢？答案上否定的，因为在C#中不存在全局变量这个概念。但是我们可以借签C#中的另外一种技术实现类似于全局变量的概念，既<strong><font color="#ff0000">静态类</font></strong>。通过定义静态类的静态字段来记录保存全局状态。</p>
<blockquote style="margin-right: 0px" dir="ltr" class="articalContent  ">
<p>public static class Global</p>
<p>{</p>
<p>&nbsp;<wbr>&nbsp;<wbr>&nbsp;<wbr> private static string mUserName="小明";</p>
<p>&nbsp;<wbr>&nbsp;<wbr>&nbsp;<wbr> public static string UserName</p>
<p>&nbsp;<wbr>&nbsp;<wbr>&nbsp;<wbr> {&nbsp;<wbr></p>
<p>&nbsp;<wbr>&nbsp;<wbr>&nbsp;<wbr>&nbsp;<wbr>&nbsp;<wbr>&nbsp;<wbr>&nbsp;<wbr> get{ return mUserName; }</p>
<p>&nbsp;<wbr>&nbsp;<wbr>&nbsp;<wbr> }</p>
<p>}</p></blockquote>
<p class="articalContent  ">&nbsp;<wbr>&nbsp;<wbr>&nbsp;<wbr> 这样定义了全局静态类，那么在任何地方都可以使用 Global.UserName 来访问登陆用户的用户名了。</p> <img src ="http://www.blogjava.net/cookie731/aggbug/397905.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/cookie731/" target="_blank">梦想不只是做梦想一想</a> 2013-04-16 13:19 <a href="http://www.blogjava.net/cookie731/articles/397905.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>c#可空类型 </title><link>http://www.blogjava.net/cookie731/articles/397902.html</link><dc:creator>梦想不只是做梦想一想</dc:creator><author>梦想不只是做梦想一想</author><pubDate>Tue, 16 Apr 2013 05:04:00 GMT</pubDate><guid>http://www.blogjava.net/cookie731/articles/397902.html</guid><wfw:comment>http://www.blogjava.net/cookie731/comments/397902.html</wfw:comment><comments>http://www.blogjava.net/cookie731/articles/397902.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/cookie731/comments/commentRss/397902.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/cookie731/services/trackbacks/397902.html</trackback:ping><description><![CDATA[<a href="http://www.cnblogs.com/jhxk/articles/1619867.html">http://www.cnblogs.com/jhxk/articles/1619867.html</a> <br /><br /><a href="http://blog.csdn.net/henulwj/article/details/7773037">http://blog.csdn.net/henulwj/article/details/7773037</a><img src ="http://www.blogjava.net/cookie731/aggbug/397902.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/cookie731/" target="_blank">梦想不只是做梦想一想</a> 2013-04-16 13:04 <a href="http://www.blogjava.net/cookie731/articles/397902.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Java IO流学习总结</title><link>http://www.blogjava.net/cookie731/articles/388300.html</link><dc:creator>梦想不只是做梦想一想</dc:creator><author>梦想不只是做梦想一想</author><pubDate>Fri, 21 Sep 2012 14:52:00 GMT</pubDate><guid>http://www.blogjava.net/cookie731/articles/388300.html</guid><wfw:comment>http://www.blogjava.net/cookie731/comments/388300.html</wfw:comment><comments>http://www.blogjava.net/cookie731/articles/388300.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/cookie731/comments/commentRss/388300.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/cookie731/services/trackbacks/388300.html</trackback:ping><description><![CDATA[<div><a id="cb_post_title_url" href="http://www.cnblogs.com/oubo/archive/2012/01/06/2394638.html">Java  IO流学习总结</a>http://www.cnblogs.com/oubo/archive/2012/01/06/2394638.html</div><img src ="http://www.blogjava.net/cookie731/aggbug/388300.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/cookie731/" target="_blank">梦想不只是做梦想一想</a> 2012-09-21 22:52 <a href="http://www.blogjava.net/cookie731/articles/388300.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>人生感悟：贵在悟，难在度</title><link>http://www.blogjava.net/cookie731/articles/384845.html</link><dc:creator>梦想不只是做梦想一想</dc:creator><author>梦想不只是做梦想一想</author><pubDate>Sun, 05 Aug 2012 15:29:00 GMT</pubDate><guid>http://www.blogjava.net/cookie731/articles/384845.html</guid><wfw:comment>http://www.blogjava.net/cookie731/comments/384845.html</wfw:comment><comments>http://www.blogjava.net/cookie731/articles/384845.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/cookie731/comments/commentRss/384845.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/cookie731/services/trackbacks/384845.html</trackback:ping><description><![CDATA[<div><table border="0" width="100%" align="center"> <tbody> <tr> <td> <table border="0" cellspacing="2" bordercolor="#ffffff" cellpadding="2" align="center"> <tbody> <tr> <td bgcolor="#336699" align="center"><span style="font-size: 24pt; ">人生感悟：贵在悟，难在度</span>  </td></tr></tbody></table></td></tr></tbody></table><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="font-size: 10pt; ">blog.tianya.cn/blogger/trackback.asp?BlogID=37813&amp;PostID=764031</span></div> <table border="0" cellspacing="0" width="100%" align="center"> <tbody> <tr> <td width="100" align="right"></td> <td align="center">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 作者：<a href="http://www.tianya.cn/browse/listwriter.asp?vwriter=%E7%83%9F%E8%8A%B1%E4%B8%89%E6%9C%88%E5%9C%A8%E6%89%AC%E5%B7%9E" target="_blank">烟花三月在扬州</a>&nbsp;</td> <td width="100" align="right"></td></tr></tbody></table> <div>　　  走在城市的街头，望着那川流不息南来北往的人流，细看那穿戴不一、神态各异的芸芸众生，有的坐骄车，有的乘公交，有的打的士，有的骑摩托，有的登自行车，有的徒手悠然步行，有的肩扛手提白色化肥袋子装的行李包裹在吃力移动，偶尔还会看到在垃圾箱里尽力&#8220;寻宝&#8221;的年迈老太太，看到头戴八角帽胸前挂着不少圆牌牌的流浪者，看到正在大吼大叫张牙舞爪几近裸体的精神病汉子&#8230;&#8230;  <br />　　  望着这多彩的街景，想着那&#8220;水往低处流，人往高处走&#8221;的格言，不由而感叹人生的差别与变幻，感悟人生的真谛与要诀。人生的幸福来自何方，人生的差别源自那里？&#8230;&#8230;  可以说，世间没有一个人不向往美好和幸福。 可以说，绝大多数人都在为着那美好的向往而奔波。 但结果却大不一样：有人辉煌，有人平庸，有人凄惨&#8230;&#8230; <br />　　  就是位于同一起跑线、在同样环境条件下工作和生活的人们，最后的差异也是显而易见的。何以如此呢？ 有人说，是命运决定的。 我说，命运给予条件，并不决定结果。  命运，使你生在繁华都市或是偏僻乡村，生在高干家庭、书香门弟或是工、农之家，但并不最终决定你的价值、作为和地位（高干子弟进监狱者、书香之弟碌碌无为者并不乏见）；命运，使你面临机遇，但能不能抓住机遇则是在很大程度上靠你自己。  <br />　　  有人说，人生靠勤奋。这样说也对，你偷懒不干事，什么也不会有。这样说也不完全对，不少&#8220;老黄牛&#8221;够卖劲的也很可贵但难有大的作为，农民可能是最勤奋的群体，可始终处于社会低层&#8230;&#8230;  <br />　　 细细思量，总觉得：人生贵在悟，难在度。 肯动脑，有悟性，善感悟，是人生成功的基础。言行适度，办事有分寸、知深浅，是人生成功的关键。 <br />　　  &#8220;悟&#8221;，就是通过思考，融会贯通所学知识得其神，调查研究所做之事取其要。从而明是非、识轻重、分先后，取得行动的主动和自由。凡真正的成功者，无不是爱动脑子的人，无不是感而有觉，觉而有思，思而有悟，悟而有道，道而有行，行而有果的人。学而无思，获小，谓书呆子；行而无思，果瘦，谓事倍功半。  &#8220;悟&#8221;讲的是认识，解决的是识和断的问题。就是说通过自觉的&#8220;悟&#8221;，明白了什么是好，什么是坏，知道了该干什么，不该干什么。 <br />　　  &#8220;度&#8221;讲的则是实践，解决的是程度和分寸的问题。就是说通过&#8220;度&#8221;的把握和调控，使言行适度，避免过和不及。而这是很难的。 <br />　　  人的一生，大致会经历糊涂---清楚---会糊涂这样三个阶段。少年及青年初期的血气方刚自以为清楚实为糊涂的阶段，参加工作走入社会碰了不少钉子不断醒悟和清楚的阶段，到大事清楚小事糊涂，根干清楚枝叶忽略的会糊涂阶段。三个阶段的长短，每个人各不相同。根本的原因在于对悟和度这两个字的理解、把握和践行！  <br />　　 （一 ） 悟之要点 <br />　　1，要读书，但不能读死书、死读书： <br />　　2，要有行，但更要有心。&#8220;处处留心皆学问&#8221;。  <br />　　3，要动脑，凡事忌人云亦云，随波逐流。忌口比手快，手比脑快。遇事应深思慎行寡言，&#8220;有话要想着说，不要抢着说&#8221;。  <br />　　4,要比较，前后、左右、内外地比较优劣、得失，在比较中感悟。  <br />　　5,要总结，不断疏理、积累。最好经常将所感所思所获记下来。如此一久，必有优于他人的提高。 <br />　　 （二）度之难点 <br />　　  人的吃、住、行、娱、医，工作、交际、休息&#8230;&#8230; ,都有一个度的问题，度之于人生无所不在。  把握度是把握人生的关键所在。就拿&#8220;吃&#8221;来说，大家都想有好东西吃，但一样好东西你一次吃太多，或长时间吃一样好东西，必然会有负作用。不是近年有一些人因经常贪吃海鲜而导致患痛凤病吗？  凡事同理。 适度之于人的言行为最佳状态，适度之于人的言行也是最难把握的。 难就难在：  <br />　　（1）度的基础难积累。真正把握度，需要有一定的知识、实践为基础。如果知识根底、实践根底、思想根底浅薄，是很难悟出道理、言行有度的。  <br />　　（2）度的标谁难把握。不仅在不同的行业、方面各异，而且在不同的时空、不同的人员方面有别。一般说来，度具有多样性，多层次性，多变性和灵活性（对这一点三言两语是讲不不清的）。  <br />　　（3）度的运用难自如。人生在世，凡事都不用心，不认真，糊糊涂涂浑浑噩噩的肯定不行。但凡事不分大小都较真，非搞个清清楚楚明明白白不可也不行，没必要而且不可能。如能在大事上做到得失清楚、是非清楚也就够了。实际上，有些事有时还非模糊些才好，才有利于创造良好的个人工作、生活环境。  <br />　　  所以，平时在工作和生活中，从思想上要注意分请那些事是大事，那些事是小事，那些事是鸡毛蒜皮或与己无关的事。在言行上，对大事、要事、敏感事必须十分认真谨慎、严紧严格严密，一丝不苟，毫不含糊；对小事要睁只眼闭只眼不必过于认真、苛求；对那些鸡毛蒜皮的事则一概不闻不问不辩不争，故作糊涂（大智若愚的&#8220;愚&#8221;字也许讲的就是这个意思吧）。人生能达到如此境界，人的言行能经常有这样的意识和自觉，才是最难得最可宝贵的。 &nbsp;</div></div><img src ="http://www.blogjava.net/cookie731/aggbug/384845.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/cookie731/" target="_blank">梦想不只是做梦想一想</a> 2012-08-05 23:29 <a href="http://www.blogjava.net/cookie731/articles/384845.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Eclipse快捷键</title><link>http://www.blogjava.net/cookie731/articles/384821.html</link><dc:creator>梦想不只是做梦想一想</dc:creator><author>梦想不只是做梦想一想</author><pubDate>Sun, 05 Aug 2012 09:19:00 GMT</pubDate><guid>http://www.blogjava.net/cookie731/articles/384821.html</guid><wfw:comment>http://www.blogjava.net/cookie731/comments/384821.html</wfw:comment><comments>http://www.blogjava.net/cookie731/articles/384821.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/cookie731/comments/commentRss/384821.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/cookie731/services/trackbacks/384821.html</trackback:ping><description><![CDATA[<div><span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; background-color: #ffffff; ">&nbsp;&nbsp;</span>http://usenrong.iteye.com/blog/645793<span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; background-color: #ffffff; ">&nbsp;<br />Eclipse的编辑功能非常强大，掌握了Eclipse快捷键功能，能够大大提高</span><span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; ">开发</span><span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; ">效率。<br />Eclipse中有如下一些和编辑相关的快捷键。&nbsp;</span><br /><span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; ">&nbsp; &nbsp;1. 【ALT+/】&nbsp;</span><br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /><span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; ">&nbsp; &nbsp;此快捷键为用户编辑的好帮手，能为用户提供内容的辅助，不要为记不全方法和属性名称犯愁，当记不全类、方法和属性的名字时，多体验一下【ALT+/】快捷键带来的好处吧。</span><br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /><br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /><span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; ">&nbsp; &nbsp;2. 【Ctrl+O】&nbsp;</span><br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /><span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; ">&nbsp; &nbsp;显示类中方法和属性的大纲，能快速定位类的方法和属性，在查找Bug时非常有用。</span><br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /><br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /><span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; ">&nbsp; &nbsp;3. 【Ctrl+/】&nbsp;</span><br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /><span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; ">&nbsp; &nbsp;快速添加注释，能为光标所在行或所选定行快速添加注释或取消注释，在调试的时候可能总会需要注释一些东西或取消注释，现在好了，不需要每行进行重复的注释。</span><br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /><br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /><span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; ">&nbsp; &nbsp;4. 【Ctrl+D】&nbsp;</span><br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /><span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; ">&nbsp; &nbsp;删除当前行，这也是笔者的最爱之一，不用为删除一行而按那么多次的删除键。&nbsp;</span><br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /><br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /><span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; ">&nbsp; &nbsp;5. 【Ctrl+M】&nbsp;</span><br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /><span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; ">&nbsp; &nbsp;窗口最大化和还原，用户在窗口中进行操作时，总会觉得当前窗口小（尤其在编写代码时），现在好了，试试【Ctrl+M】快捷键。&nbsp;</span><br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /><br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /><span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; ">&nbsp; &nbsp;查看和定位快捷键&nbsp;</span><br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /><br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /><span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; ">&nbsp; &nbsp;在程序中，迅速定位代码的位置，快速找到Bug的所在，是非常不容易的事，Eclipse提供了强大的查找功能，可以利用如下的快捷键帮助完成查找定位的工作。&nbsp;</span><br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /><br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /><span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; ">&nbsp; &nbsp;1. 【Ctrl+K】、【Ctrl++Shift+K】&nbsp;</span><br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /><span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; ">&nbsp; &nbsp;快速向下和向上查找选定的内容，从此不再需要用鼠标单击查找对话框了。&nbsp;</span><br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /><br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /><span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; ">&nbsp; &nbsp;2. 【Ctrl+Shift+T】&nbsp;</span><br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /><span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; ">&nbsp; &nbsp;查找工作空间（Workspace）构建路径中的可找到Java类文件，不要为找不到类而痛苦，而且可以使用&#8220;*&#8221;、&#8220;？&#8221;等通配符。&nbsp;</span><br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /><br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /><span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; ">&nbsp; &nbsp;3. 【Ctrl+Shift+R】&nbsp;</span><br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /><span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; ">&nbsp; &nbsp;和【Ctrl+Shift+T】对应，查找工作空间（Workspace）中的所有文件（包括Java文件），也可以使用通配符。&nbsp;</span><br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /><br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /><span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; ">&nbsp; &nbsp;4. 【Ctrl+Shift+G】&nbsp;</span><br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /><span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; ">&nbsp; &nbsp;查找类、方法和属性的引用。这是一个非常实用的快捷键，例如要修改引用某个方法的代码，可以通过【Ctrl+Shift+G】快捷键迅速定位所有引用此方法的位置。&nbsp;</span><br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /><br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /><span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; ">&nbsp; &nbsp;5. 【Ctrl+Shift+O】&nbsp;</span><br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /><span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; ">快速生成import，当从网上拷贝一段程序后，不知道如何import进所调用的类，试试【Ctrl+Shift+O】快捷键，一定会有惊喜。&nbsp;</span><br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /><br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /><span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; ">&nbsp; &nbsp;6. 【Ctrl+Shift+F】&nbsp;</span><br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /><span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; ">&nbsp; &nbsp;格式化代码，书写格式规范的代码是每一个程序员的必修之课，当看见某段代码极不顺眼时，选定后按【Ctrl+Shift+F】快捷键可以格式化这段代码，如果不选定代码则默认格式化当前文件（Java文件）。&nbsp;</span><br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /><br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /><span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; ">&nbsp; &nbsp;7. 【ALT+Shift+W】&nbsp;</span><br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /><span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; ">&nbsp; &nbsp;查找当前文件所在项目中的路径，可以快速定位浏览器视图的位置，如果想查找某个文件所在的包时，此快捷键非常有用（特别在比较大的项目中）。&nbsp;</span><br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /><br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /><span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; ">&nbsp; &nbsp;8. 【Ctrl+L】&nbsp;</span><br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /><span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; ">&nbsp; &nbsp;定位到当前编辑器的某一行，对非Java文件也有效。</span><br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /><br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /><span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; ">&nbsp; &nbsp;9. 【Alt+&#8592;】、【Alt+&#8594;】&nbsp;</span><br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /><span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; ">&nbsp; &nbsp;后退历史记录和前进历史记录，在跟踪代码时非常有用，用户可能查找了几个有关联的地方，但可能记不清楚了，可以通过这两个快捷键定位查找的顺序。&nbsp;</span><br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /><br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /><span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; ">&nbsp; &nbsp;10. 【F3】&nbsp;</span><br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /><span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; ">快速定位光标位置的某个类、方法和属性。</span><br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /><br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /><span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; ">&nbsp; &nbsp;11. 【F4】&nbsp;</span><br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /><span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; ">&nbsp; &nbsp;显示类的继承关系，并打开类继承视图。</span><br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /><br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /><span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; ">&nbsp; &nbsp;调试快捷键&nbsp;</span><br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /><br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /><span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; ">&nbsp; &nbsp;Eclipse中有如下一些和运行调试相关的快捷键。</span><br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /><br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /><span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; ">&nbsp; &nbsp;1. 【Ctrl+Shift+B】：在当前行设置断点或取消设置的断点。&nbsp;</span><br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /><span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; ">&nbsp; &nbsp;2. 【F11】：调试最后一次执行的程序。&nbsp;</span><br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /><span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; ">&nbsp; &nbsp;3. 【Ctrl+F11】：运行最后一次执行的程序。&nbsp;</span><br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /><span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; ">&nbsp; &nbsp;4. 【F5】：跟踪到方法中，当程序执行到某方法时，可以按【F5】键跟踪到方法中。&nbsp;</span><br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /><span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; ">&nbsp; &nbsp;5. 【F6】：单步执行程序。&nbsp;</span><br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /><span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; ">&nbsp; &nbsp;6. 【F7】：执行完方法，返回到调用此方法的后一条语句。&nbsp;</span><br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /><span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; ">&nbsp; &nbsp;7. 【F8】：继续执行，到下一个断点或程序结束。&nbsp;</span><br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /><br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /><span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; ">&nbsp; &nbsp;常用编辑器快捷键&nbsp;</span><br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /><br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /><span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; ">&nbsp; &nbsp;通常文本编辑器都提供了一些和编辑相关的快捷键，在Eclipse中也可以通过这些快捷键进行文本编辑。&nbsp;</span><br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /><span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; ">&nbsp; &nbsp;1. 【Ctrl+C】：复制。&nbsp;</span><br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /><span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; ">&nbsp; &nbsp;2. 【Ctrl+X】：剪切。&nbsp;</span><br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /><span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; ">&nbsp; &nbsp;3. 【Ctrl+V】：粘贴。&nbsp;</span><br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /><span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; ">&nbsp; &nbsp;4. 【Ctrl+S】：保存文件。&nbsp;</span><br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /><span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; ">&nbsp; &nbsp;5. 【Ctrl+Z】：撤销。&nbsp;</span><br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /><span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; ">&nbsp; &nbsp;6. 【Ctrl+Y】：重复。&nbsp;</span><br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /><span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; ">&nbsp; &nbsp;7. 【Ctrl+F】：查找。&nbsp;</span><br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /><br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /><span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; ">&nbsp; &nbsp;其他快捷键&nbsp;</span><br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /><br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /><span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; ">&nbsp; &nbsp;Eclipse中还有很多快捷键，无法一一列举，用户可以通过帮助</span><span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; ">文档</span><span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; ">找到它们的使用方式，另外还有几个常用的快捷键如下。&nbsp;</span><br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /><span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; ">&nbsp; &nbsp;1. 【Ctrl+F6】：切换到下一个编辑器。&nbsp;</span><br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /><span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; ">&nbsp; &nbsp;2. 【Ctrl+Shift+F6】：切换到上一个编辑器。&nbsp;</span><br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /><span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; ">&nbsp; &nbsp;3. 【Ctrl+F7】：切换到下一个视图。&nbsp;</span><br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /><span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; ">&nbsp; &nbsp;4. 【Ctrl+Shift+F7】：切换到上一个视图。&nbsp;</span><br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /><span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; ">&nbsp; &nbsp;5. 【Ctrl+F8】：切换到下一个透视图。&nbsp;</span><br style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; " /><span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25px; text-align: left; background-color: #ffffff; ">&nbsp; &nbsp;6. 【Ctrl+Shift+F8】：切换到上一个透视图。</span></div><img src ="http://www.blogjava.net/cookie731/aggbug/384821.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/cookie731/" target="_blank">梦想不只是做梦想一想</a> 2012-08-05 17:19 <a href="http://www.blogjava.net/cookie731/articles/384821.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>