﻿<?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>博客园-Inside.Net</title><link>http://www.cnblogs.com/bluefee/</link><description>自由与繁荣的国度</description><language>zh-cn</language><lastBuildDate>Thu, 28 Aug 2008 03:18:11 GMT</lastBuildDate><pubDate>Thu, 28 Aug 2008 03:18:11 GMT</pubDate><ttl>60</ttl><item><title>初窥LUA.NET</title><link>http://www.cnblogs.com/bluefee/archive/2005/04/13/136609.html</link><dc:creator>Bluefee.Net</dc:creator><author>Bluefee.Net</author><pubDate>Wed, 13 Apr 2005 02:22:00 GMT</pubDate><guid>http://www.cnblogs.com/bluefee/archive/2005/04/13/136609.html</guid><wfw:comment>http://www.cnblogs.com/bluefee/comments/136609.html</wfw:comment><comments>http://www.cnblogs.com/bluefee/archive/2005/04/13/136609.html#Feedback</comments><slash:comments>7</slash:comments><wfw:commentRss>http://www.cnblogs.com/bluefee/comments/commentRss/136609.html</wfw:commentRss><trackback:ping>http://www.cnblogs.com/bluefee/services/trackbacks/136609.html</trackback:ping><description><![CDATA[&nbsp; 最近在研究WOW Interface，由于提供的函数和允许使用的语言是LUA所以顺便找了一下看有没有和.NET CLR交互的版本，结果让我找到了，嘿嘿!下面让我们看一下在.NET中怎么使用LUA <br>&nbsp; 我们看下官方网站提供的例子来初窥Lua.Net <br><br>
<p><span style="COLOR: blue">&nbsp;</p>
<div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><img src="http://www.cnblogs.com/images/OutliningIndicators/None.gif" align=top><span style="COLOR: #000000">&nbsp;&nbsp;&nbsp;luanet&nbsp;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">&nbsp;require(</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">luainterface</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">)&nbsp;<br><img src="http://www.cnblogs.com/images/OutliningIndicators/None.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;luanet.load_assembly(</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">System.Windows.Forms</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">)&nbsp;<br><img src="http://www.cnblogs.com/images/OutliningIndicators/None.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;luanet.load_assembly(</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">System.Drawing</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">)&nbsp;<br><img src="http://www.cnblogs.com/images/OutliningIndicators/None.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;<br><img src="http://www.cnblogs.com/images/OutliningIndicators/None.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;Form&nbsp;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">&nbsp;luanet.import_type(</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">System.Windows.Forms.Form</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">)&nbsp;<br><img src="http://www.cnblogs.com/images/OutliningIndicators/None.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;Button&nbsp;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">&nbsp;luanet.import_type(</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">System.Windows.Forms.Button</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">)&nbsp;<br><img src="http://www.cnblogs.com/images/OutliningIndicators/None.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;Point&nbsp;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">&nbsp;luanet.import_type(</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">System.Drawing.Point</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">)&nbsp;<br><img src="http://www.cnblogs.com/images/OutliningIndicators/None.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br><img src="http://www.cnblogs.com/images/OutliningIndicators/None.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;mainForm&nbsp;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">&nbsp;Form()&nbsp;<br><img src="http://www.cnblogs.com/images/OutliningIndicators/None.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;buttonOk&nbsp;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">&nbsp;Button()&nbsp;<br><img src="http://www.cnblogs.com/images/OutliningIndicators/None.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;buttonCancel&nbsp;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">&nbsp;Button()&nbsp;<br><img src="http://www.cnblogs.com/images/OutliningIndicators/None.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;<br><img src="http://www.cnblogs.com/images/OutliningIndicators/None.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;buttonOk.Text&nbsp;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">Ok</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">&nbsp;<br><img src="http://www.cnblogs.com/images/OutliningIndicators/None.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;buttonCancel.Text&nbsp;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">Cancel</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">&nbsp;<br><img src="http://www.cnblogs.com/images/OutliningIndicators/None.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;buttonOk.Location&nbsp;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">&nbsp;Point(</span><span style="COLOR: #000000">10</span><span style="COLOR: #000000">,</span><span style="COLOR: #000000">10</span><span style="COLOR: #000000">)&nbsp;<br><img src="http://www.cnblogs.com/images/OutliningIndicators/None.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;buttonCancel.Location&nbsp;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">&nbsp;Point(buttonOk.Left,&nbsp;buttonOk.Height&nbsp;</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">&nbsp;<br><img src="http://www.cnblogs.com/images/OutliningIndicators/None.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;buttonOk.Top&nbsp;</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">&nbsp;</span><span style="COLOR: #000000">10</span><span style="COLOR: #000000">)&nbsp;<br><img src="http://www.cnblogs.com/images/OutliningIndicators/None.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;mainForm.Controls:Add(buttonOk)&nbsp;<br><img src="http://www.cnblogs.com/images/OutliningIndicators/None.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;mainForm.Controls:Add(buttonCancel)&nbsp;<br><img src="http://www.cnblogs.com/images/OutliningIndicators/None.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;mainForm.StartPosition&nbsp;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">&nbsp;<br><img src="http://www.cnblogs.com/images/OutliningIndicators/None.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;import_type(</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">System.Windows.Forms.FormStartPosition</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">).CenterScreen&nbsp;<br><img src="http://www.cnblogs.com/images/OutliningIndicators/None.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;<br><img src="http://www.cnblogs.com/images/OutliningIndicators/None.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;function&nbsp;handleMouseUp(sender,args)&nbsp;<br><img src="http://www.cnblogs.com/images/OutliningIndicators/None.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;print(sender:ToString()&nbsp;..&nbsp;</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">&nbsp;MouseUp!</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">)&nbsp;<br><img src="http://www.cnblogs.com/images/OutliningIndicators/None.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;end&nbsp;<br><img src="http://www.cnblogs.com/images/OutliningIndicators/None.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;<br><img src="http://www.cnblogs.com/images/OutliningIndicators/None.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;handlerUp&nbsp;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">&nbsp;buttonOk.MouseUp:Add(handleMouseUp)&nbsp;<br><img src="http://www.cnblogs.com/images/OutliningIndicators/None.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;handlerClick&nbsp;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">&nbsp;buttonCancel.Click:Add(os.exit)&nbsp;<br><img src="http://www.cnblogs.com/images/OutliningIndicators/None.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;<br><img src="http://www.cnblogs.com/images/OutliningIndicators/None.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;mainForm:ShowDialog()&nbsp;</span></div>
<p></span><br><br>由于还没有可视化编程环境的支持，用Lua.Net写一个WinForm程序可以用变态来形容，所有的控件要自行添加到Controls集合中，并且还要自行指定在窗体中的位置，看看buttonOk.Location = Point(10,10);就知道了，这种非可视化的开发非常的不方便。使用lua.net的唯一理由可能是你需要调用一些用lua写的函数，呵呵 <br>下面给出官方网站： <br><a href="http://bandodalua.lua.inf.puc-rio.br/luanet/">http://bandodalua.lua.inf.puc-rio.br/luanet/</a> </p>
<img src ="http://www.cnblogs.com/bluefee/aggbug/136609.html?type=1" width = "1" height = "1" /><br><br><a href="http://news.cnblogs.com/n/41931/" target="_blank">[新闻]GC2008：星际争霸2进程报告 微调进程延续</a>]]></description></item><item><title>硝烟弥漫-GOOLE Fans的立场</title><link>http://www.cnblogs.com/bluefee/archive/2005/04/09/134902.html</link><dc:creator>Bluefee.Net</dc:creator><author>Bluefee.Net</author><pubDate>Sat, 09 Apr 2005 15:38:00 GMT</pubDate><guid>http://www.cnblogs.com/bluefee/archive/2005/04/09/134902.html</guid><wfw:comment>http://www.cnblogs.com/bluefee/comments/134902.html</wfw:comment><comments>http://www.cnblogs.com/bluefee/archive/2005/04/09/134902.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnblogs.com/bluefee/comments/commentRss/134902.html</wfw:commentRss><trackback:ping>http://www.cnblogs.com/bluefee/services/trackbacks/134902.html</trackback:ping><description><![CDATA[&#160;&#160;&#160;&#160; 刚才无意中点了一个公益广告&#8220;谁发明了饺子？&#8221;以调节一下无聊的气氛，呵呵！结果看到了这个 
<br/>
<br/><img height="355" hspace="5" src="http://www.cnblogs.com/images/cnblogs_com/bluefee/jiaozi.jpg" width="640" align="baseline" /> 
<br/>
<br/>看来大家好像对IE意见蛮大的哦！<img src ="http://www.cnblogs.com/bluefee/aggbug/134902.html?type=1" width = "1" height = "1" /><br><br><a href="http://news.cnblogs.com/n/41930/" target="_blank">[新闻]科学家在世界最大对撞机中观察到首批粒子</a>]]></description></item><item><title>C#$2.0-迭代器应用 [ 4 ]</title><link>http://www.cnblogs.com/bluefee/archive/2005/04/07/133501.html</link><dc:creator>Bluefee.Net</dc:creator><author>Bluefee.Net</author><pubDate>Thu, 07 Apr 2005 12:05:00 GMT</pubDate><guid>http://www.cnblogs.com/bluefee/archive/2005/04/07/133501.html</guid><wfw:comment>http://www.cnblogs.com/bluefee/comments/133501.html</wfw:comment><comments>http://www.cnblogs.com/bluefee/archive/2005/04/07/133501.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnblogs.com/bluefee/comments/commentRss/133501.html</wfw:commentRss><trackback:ping>http://www.cnblogs.com/bluefee/services/trackbacks/133501.html</trackback:ping><description><![CDATA[<font size="3"><span lang="EN-US" style="COLOR: maroon"><font face="Times New Roman"><span style="FONT-SIZE: 10pt"><font size="3"><span lang="EN-US" style="COLOR: maroon"><font face="Times New Roman"><span style="FONT-SIZE: 14pt"><font size="3"><span lang="EN-US" style="COLOR: maroon"><font face="Times New Roman"><span style="FONT-SIZE: 10pt"><font size="3"><span lang="EN-US" style="COLOR: maroon"><font face="Times New Roman"><span style="FONT-SIZE: 10pt"><font size="3" style="FONT-SIZE: 8pt"><span lang="EN-US" style="COLOR: maroon"><font face="Times New Roman"><span style="FONT-SIZE: 10pt"><font size="3"><span lang="EN-US" style="COLOR: maroon"><font face="Times New Roman"><span style="FONT-SIZE: 14pt"><font size="3"><span lang="EN-US" style="COLOR: maroon"><font face="Times New Roman"><span style="FONT-SIZE: 10pt">
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><font size="3"><span lang="EN-US" style="COLOR: maroon"><font face="Times New Roman">C# 2.0</font></span><span style="COLOR: maroon; FONT-FAMILY: 宋体; mso-hansi-font-family: &#39;Times New Roman&#39;; mso-ascii-font-family: &#39;Times New Roman&#39;">编译器和迭代</span><span lang="EN-US" style="COLOR: maroon"><o:p></o:p></span></font> 
</p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt; mso-char-indent-count: 2.0; mso-char-indent-size: 10.5pt"><font size="3" style="COLOR: #000000"><span style="FONT-FAMILY: 宋体; mso-hansi-font-family: &#39;Times New Roman&#39;; mso-ascii-font-family: &#39;Times New Roman&#39;">如果你是一个好奇的开发者，你可能乐意看到</span><span lang="EN-US"><font face="Times New Roman">C# 2.0</font></span><span style="FONT-FAMILY: 宋体; mso-hansi-font-family: &#39;Times New Roman&#39;; mso-ascii-font-family: &#39;Times New Roman&#39;">编译解释</span><span lang="EN-US" style="COLOR: blue"><font face="Times New Roman">yield break</font></span><span style="FONT-FAMILY: 宋体; mso-hansi-font-family: &#39;Times New Roman&#39;; mso-ascii-font-family: &#39;Times New Roman&#39;">和</span><span lang="EN-US" style="COLOR: blue"><font face="Times New Roman">yield return</font></span><span style="FONT-FAMILY: 宋体; mso-hansi-font-family: &#39;Times New Roman&#39;; mso-ascii-font-family: &#39;Times New Roman&#39;">关键字所作的工作。这是本节的主题。请注意迭代器是作为语法出现的不像范型，没有</span><span lang="EN-US"><font face="Times New Roman">IL</font></span><span style="FONT-FAMILY: 宋体; mso-hansi-font-family: &#39;Times New Roman&#39;; mso-ascii-font-family: &#39;Times New Roman&#39;">指令集被添加作为实现迭代。</span><span lang="EN-US" style="COLOR: maroon"><o:p></o:p></span></font> 
</p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt; mso-char-indent-count: 2.0; mso-char-indent-size: 10.5pt"><span lang="EN-US" style="COLOR: maroon"><font face="Times New Roman"><font size="3">&#160;<o:p></o:p></font></font></span> 
</p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><font size="3"><span style="COLOR: maroon; FONT-FAMILY: 宋体; mso-hansi-font-family: &#39;Times New Roman&#39;; mso-ascii-font-family: &#39;Times New Roman&#39;">使用编译器自动创建枚举器类</span></font> 
</p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"><span style="FONT-SIZE: 10.5pt; COLOR: #000000; FONT-FAMILY: 宋体; mso-hansi-font-family: &#39;Times New Roman&#39;; mso-ascii-font-family: &#39;Times New Roman&#39;; mso-bidi-font-family: &#39;Times New Roman&#39;; mso-bidi-font-size: 12.0pt; mso-font-kerning: 1.0pt; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA">&#160;&#160;&#160; 一个至少包含一个</span><span lang="EN-US" style="FONT-SIZE: 10.5pt; COLOR: blue; FONT-FAMILY: &#39;Times New Roman&#39;; mso-bidi-font-size: 12.0pt; mso-fareast-font-family: 宋体; mso-font-kerning: 1.0pt; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA">yield break</span><span style="FONT-SIZE: 10.5pt; COLOR: #000000; FONT-FAMILY: 宋体; mso-hansi-font-family: &#39;Times New Roman&#39;; mso-ascii-font-family: &#39;Times New Roman&#39;; mso-bidi-font-family: &#39;Times New Roman&#39;; mso-bidi-font-size: 12.0pt; mso-font-kerning: 1.0pt; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA">或</span><span lang="EN-US" style="FONT-SIZE: 10.5pt; COLOR: blue; FONT-FAMILY: &#39;Times New Roman&#39;; mso-bidi-font-size: 12.0pt; mso-fareast-font-family: 宋体; mso-font-kerning: 1.0pt; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA">yield return<span style="FONT-FAMILY: 宋体; mso-hansi-font-family: &#39;Times New Roman&#39;; mso-ascii-font-family: &#39;Times New Roman&#39;"><font color="#000000">关键字的方法必须返回一个枚举或枚举器（范型实现或不是）类型。无论如何，你应该考虑的是一个被返回的枚举器对象应该是一个实现了枚举接口并返回一个枚举器类型的实现。如果你读过前面的关于匿名方法的文章，那么你可能已经猜到对于每一个至少包含一个</font></span><span lang="EN-US" style="COLOR: blue">yield break</span><span style="FONT-FAMILY: 宋体; mso-hansi-font-family: &#39;Times New Roman&#39;; mso-ascii-font-family: &#39;Times New Roman&#39;"><font color="#000000">或</font></span><span lang="EN-US" style="COLOR: blue">yield return</span><span style="FONT-FAMILY: 宋体; mso-hansi-font-family: &#39;Times New Roman&#39;; mso-ascii-font-family: &#39;Times New Roman&#39;"><font color="#000000">关键字的方法，编译器为其构建出一种词法环境。如果方法返回了一个枚举对象那么这个创建的类中实现</font><span style="COLOR: blue">了</span></span><font color="#000000"><span class="style1"><span lang="EN-US">System.Collections.IEnumerable</span></span><span lang="EN-US">, <span class="style1">System.Collections.Generic.IEnumerator&lt;T&gt;</span> </span><span style="FONT-FAMILY: 宋体; mso-hansi-font-family: &#39;Times New Roman&#39;; mso-ascii-font-family: &#39;Times New Roman&#39;">以及</span> <span class="style1"><span lang="EN-US">System.Collections</span></span><span class="style1"><span style="FONT-FAMILY: 宋体; mso-hansi-font-family: &#39;Times New Roman&#39;; mso-ascii-font-family: &#39;Times New Roman&#39;">接口。此外，这个方法不能直接编译。让我们看一个例子：
<br/></span><span lang="EN-US"><o:p>
   <div style="BORDER-RIGHT: windowtext 0.5pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: windowtext 0.5pt solid; PADDING-LEFT: 5.4pt; BACKGROUND: #e6e6e6; PADDING-BOTTOM: 4px; BORDER-LEFT: windowtext 0.5pt solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: windowtext 0.5pt solid">
       <div><img height="16" src="http://www.cnblogs.com/images/OutliningIndicators/None.gif" width="11" align="top" /><span style="COLOR: #0000ff">using</span><span style="COLOR: #000000">&#160;System;
<br/><img height="16" src="http://www.cnblogs.com/images/OutliningIndicators/None.gif" width="11" align="top" /></span><span style="COLOR: #0000ff">using</span><span style="COLOR: #000000">&#160;System.Collections.Generic;
<br/><img height="16" src="http://www.cnblogs.com/images/OutliningIndicators/None.gif" width="11" align="top" /></span><span style="COLOR: #0000ff">class</span><span style="COLOR: #000000">&#160;AClass
<br/><img id="Codehighlighter1_61_177_Open_Image" onclick="this.style.display=&#39;none&#39;; Codehighlighter1_61_177_Open_Text.style.display=&#39;none&#39;; Codehighlighter1_61_177_Closed_Image.style.display=&#39;inline&#39;; Codehighlighter1_61_177_Closed_Text.style.display=&#39;inline&#39;;" height="16" src="http://www.cnblogs.com/images/OutliningIndicators/ExpandedBlockStart.gif" width="11" align="top" /><img id="Codehighlighter1_61_177_Closed_Image" onclick="this.style.display=&#39;none&#39;; Codehighlighter1_61_177_Closed_Text.style.display=&#39;none&#39;; Codehighlighter1_61_177_Open_Image.style.display=&#39;inline&#39;; Codehighlighter1_61_177_Open_Text.style.display=&#39;inline&#39;;" height="16" src="http://www.cnblogs.com/images/OutliningIndicators/ContractedBlock.gif" width="11" align="top" style="DISPLAY: none" /></span><span id="Codehighlighter1_61_177_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img height="20" src="http://www.cnblogs.com/images/dot.gif" width="15" /></span><span id="Codehighlighter1_61_177_Open_Text"><span style="COLOR: #000000">{
<br/><img height="16" src="http://www.cnblogs.com/images/OutliningIndicators/InBlock.gif" width="11" align="top" />&#160;&#160;</span><span style="COLOR: #0000ff">public</span><span style="COLOR: #000000">&#160;Ienumerable</span><span style="COLOR: #000000">&lt;</span><span style="COLOR: #0000ff">string</span><span style="COLOR: #000000">&gt;</span><span style="COLOR: #000000">&#160;AnIterateur()
<br/><img id="Codehighlighter1_108_175_Open_Image" onclick="this.style.display=&#39;none&#39;; Codehighlighter1_108_175_Open_Text.style.display=&#39;none&#39;; Codehighlighter1_108_175_Closed_Image.style.display=&#39;inline&#39;; Codehighlighter1_108_175_Closed_Text.style.display=&#39;inline&#39;;" height="16" src="http://www.cnblogs.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" width="11" align="top" /><img id="Codehighlighter1_108_175_Closed_Image" onclick="this.style.display=&#39;none&#39;; Codehighlighter1_108_175_Closed_Text.style.display=&#39;none&#39;; Codehighlighter1_108_175_Open_Image.style.display=&#39;inline&#39;; Codehighlighter1_108_175_Open_Text.style.display=&#39;inline&#39;;" height="16" src="http://www.cnblogs.com/images/OutliningIndicators/ContractedSubBlock.gif" width="11" align="top" style="DISPLAY: none" />&#160;&#160;</span><span id="Codehighlighter1_108_175_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img height="20" src="http://www.cnblogs.com/images/dot.gif" width="15" /></span><span id="Codehighlighter1_108_175_Open_Text"><span style="COLOR: #000000">{
<br/><img height="16" src="http://www.cnblogs.com/images/OutliningIndicators/InBlock.gif" width="11" align="top" />yield&#160;</span><span style="COLOR: #0000ff">return</span><span style="COLOR: #000000">&#160;&#8220;str1&#8221;;
<br/><img height="16" src="http://www.cnblogs.com/images/OutliningIndicators/InBlock.gif" width="11" align="top" />yield&#160;</span><span style="COLOR: #0000ff">return</span><span style="COLOR: #000000">&#160;&#8220;str2&#8221;;
<br/><img height="16" src="http://www.cnblogs.com/images/OutliningIndicators/InBlock.gif" width="11" align="top" />yield&#160;</span><span style="COLOR: #0000ff">return</span><span style="COLOR: #000000">&#160;&#8220;str3&#8221;;
<br/><img height="16" src="http://www.cnblogs.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" width="11" align="top" />&#160;&#160;}</span></span><span style="COLOR: #000000">
<br/><img height="16" src="http://www.cnblogs.com/images/OutliningIndicators/ExpandedBlockEnd.gif" width="11" align="top" />}</span></span><span style="COLOR: #000000">
<br/><img height="16" src="http://www.cnblogs.com/images/OutliningIndicators/None.gif" width="11" align="top" /></span><span style="COLOR: #0000ff">class</span><span style="COLOR: #000000">&#160;Program
<br/><img id="Codehighlighter1_193_361_Open_Image" onclick="this.style.display=&#39;none&#39;; Codehighlighter1_193_361_Open_Text.style.display=&#39;none&#39;; Codehighlighter1_193_361_Closed_Image.style.display=&#39;inline&#39;; Codehighlighter1_193_361_Closed_Text.style.display=&#39;inline&#39;;" height="16" src="http://www.cnblogs.com/images/OutliningIndicators/ExpandedBlockStart.gif" width="11" align="top" /><img id="Codehighlighter1_193_361_Closed_Image" onclick="this.style.display=&#39;none&#39;; Codehighlighter1_193_361_Closed_Text.style.display=&#39;none&#39;; Codehighlighter1_193_361_Open_Image.style.display=&#39;inline&#39;; Codehighlighter1_193_361_Open_Text.style.display=&#39;inline&#39;;" height="16" src="http://www.cnblogs.com/images/OutliningIndicators/ContractedBlock.gif" width="11" align="top" style="DISPLAY: none" /></span><span id="Codehighlighter1_193_361_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img height="20" src="http://www.cnblogs.com/images/dot.gif" width="15" /></span><span id="Codehighlighter1_193_361_Open_Text"><span style="COLOR: #000000">{
<br/><img height="16" src="http://www.cnblogs.com/images/OutliningIndicators/InBlock.gif" width="11" align="top" />&#160;&#160;</span><span style="COLOR: #0000ff">static</span><span style="COLOR: #000000">&#160;</span><span style="COLOR: #0000ff">void</span><span style="COLOR: #000000">&#160;Main(</span><span style="COLOR: #0000ff">string</span><span style="COLOR: #000000">[]&#160;args)
<br/><img id="Codehighlighter1_231_359_Open_Image" onclick="this.style.display=&#39;none&#39;; Codehighlighter1_231_359_Open_Text.style.display=&#39;none&#39;; Codehighlighter1_231_359_Closed_Image.style.display=&#39;inline&#39;; Codehighlighter1_231_359_Closed_Text.style.display=&#39;inline&#39;;" height="16" src="http://www.cnblogs.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" width="11" align="top" /><img id="Codehighlighter1_231_359_Closed_Image" onclick="this.style.display=&#39;none&#39;; Codehighlighter1_231_359_Closed_Text.style.display=&#39;none&#39;; Codehighlighter1_231_359_Open_Image.style.display=&#39;inline&#39;; Codehighlighter1_231_359_Open_Text.style.display=&#39;inline&#39;;" height="16" src="http://www.cnblogs.com/images/OutliningIndicators/ContractedSubBlock.gif" width="11" align="top" style="DISPLAY: none" />&#160;&#160;</span><span id="Codehighlighter1_231_359_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img height="20" src="http://www.cnblogs.com/images/dot.gif" width="15" /></span><span id="Codehighlighter1_231_359_Open_Text"><span style="COLOR: #000000">{
<br/><img height="16" src="http://www.cnblogs.com/images/OutliningIndicators/InBlock.gif" width="11" align="top" />AClass&#160;collec&#160;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">&#160;</span><span style="COLOR: #0000ff">new</span><span style="COLOR: #000000">&#160;AClass();
<br/><img height="16" src="http://www.cnblogs.com/images/OutliningIndicators/InBlock.gif" width="11" align="top" /></span><span style="COLOR: #0000ff">foreach</span><span style="COLOR: #000000">&#160;(&#160;</span><span style="COLOR: #0000ff">string</span><span style="COLOR: #000000">&#160;s&#160;</span><span style="COLOR: #0000ff">in</span><span style="COLOR: #000000">&#160;collec.AnIterateur())
<br/><img id="Codehighlighter1_307_355_Open_Image" onclick="this.style.display=&#39;none&#39;; Codehighlighter1_307_355_Open_Text.style.display=&#39;none&#39;; Codehighlighter1_307_355_Closed_Image.style.display=&#39;inline&#39;; Codehighlighter1_307_355_Closed_Text.style.display=&#39;inline&#39;;" height="16" src="http://www.cnblogs.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" width="11" align="top" /><img id="Codehighlighter1_307_355_Closed_Image" onclick="this.style.display=&#39;none&#39;; Codehighlighter1_307_355_Closed_Text.style.display=&#39;none&#39;; Codehighlighter1_307_355_Open_Image.style.display=&#39;inline&#39;; Codehighlighter1_307_355_Open_Text.style.display=&#39;inline&#39;;" height="16" src="http://www.cnblogs.com/images/OutliningIndicators/ContractedSubBlock.gif" width="11" align="top" style="DISPLAY: none" /></span><span id="Codehighlighter1_307_355_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img height="20" src="http://www.cnblogs.com/images/dot.gif" width="15" /></span><span id="Codehighlighter1_307_355_Open_Text"><span style="COLOR: #000000">{
<br/><img height="16" src="http://www.cnblogs.com/images/OutliningIndicators/InBlock.gif" width="11" align="top" />&#160;&#160;Console.WriteLine(s);
<br/><img height="16" src="http://www.cnblogs.com/images/OutliningIndicators/InBlock.gif" width="11" align="top" />&#160;&#160;Console.ReadLine();
<br/><img height="16" src="http://www.cnblogs.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" width="11" align="top" />}</span></span><span style="COLOR: #000000">
<br/><img height="16" src="http://www.cnblogs.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" width="11" align="top" />&#160;&#160;}</span></span><span style="COLOR: #000000">
<br/><img height="16" src="http://www.cnblogs.com/images/OutliningIndicators/ExpandedBlockEnd.gif" width="11" align="top" />}</span></span><span style="COLOR: #000000">
<br/><img height="16" src="http://www.cnblogs.com/images/OutliningIndicators/None.gif" width="11" align="top" /></span>
       </div>
   </div>
<br/><span class="style1"><span style="FONT-SIZE: 10.5pt; FONT-FAMILY: 宋体; mso-hansi-font-family: &#39;Times New Roman&#39;; mso-ascii-font-family: &#39;Times New Roman&#39;; mso-bidi-font-family: &#39;Times New Roman&#39;; mso-bidi-font-size: 12.0pt; mso-font-kerning: 1.0pt; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA">接着我们使用了</span><span lang="EN-US" style="FONT-SIZE: 10.5pt; FONT-FAMILY: &quot;Times New Roman&quot;; mso-bidi-font-size: 12.0pt; mso-fareast-font-family: 宋体; mso-font-kerning: 1.0pt; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA">Reflector</span><span style="FONT-SIZE: 10.5pt; FONT-FAMILY: 宋体; mso-hansi-font-family: &#39;Times New Roman&#39;; mso-ascii-font-family: &#39;Times New Roman&#39;; mso-bidi-font-family: &#39;Times New Roman&#39;; mso-bidi-font-size: 12.0pt; mso-font-kerning: 1.0pt; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA">查看编译后的配件：
<br/><img height="397" hspace="5" src="http://www.cnblogs.com/images/cnblogs_com/bluefee/IMG03.gif" width="550" align="baseline" />
<br/>
<br/><span class="style1"><span style="FONT-SIZE: 10.5pt; FONT-FAMILY: 宋体; mso-hansi-font-family: &#39;Times New Roman&#39;; mso-ascii-font-family: &#39;Times New Roman&#39;; mso-bidi-font-family: &#39;Times New Roman&#39;; mso-bidi-font-size: 12.0pt; mso-font-kerning: 1.0pt; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA">&#160;&#160;&#160; 为了看的更清楚，我们反编译了</span><span lang="EN-US" style="FONT-SIZE: 10.5pt; FONT-FAMILY: &quot;Times New Roman&quot;; mso-bidi-font-size: 12.0pt; mso-fareast-font-family: 宋体; mso-font-kerning: 1.0pt; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA">Main()</span><span style="FONT-SIZE: 10.5pt; FONT-FAMILY: 宋体; mso-hansi-font-family: &#39;Times New Roman&#39;; mso-ascii-font-family: &#39;Times New Roman&#39;; mso-bidi-font-family: &#39;Times New Roman&#39;; mso-bidi-font-size: 12.0pt; mso-font-kerning: 1.0pt; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA">方法。接着我们会看到一个名为</span><span lang="EN-US" style="FONT-SIZE: 10.5pt; FONT-FAMILY: &quot;Times New Roman&quot;; mso-bidi-font-size: 12.0pt; mso-fareast-font-family: 宋体; mso-font-kerning: 1.0pt; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA">&lt;AnIteratuer&gt;d_0</span><span style="FONT-SIZE: 10.5pt; FONT-FAMILY: 宋体; mso-hansi-font-family: &#39;Times New Roman&#39;; mso-ascii-font-family: &#39;Times New Roman&#39;; mso-bidi-font-family: &#39;Times New Roman&#39;; mso-bidi-font-size: 12.0pt; mso-font-kerning: 1.0pt; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA">类实例被创建。在前面的论述中我们提过一个匿名方法是某种封闭（</span><span lang="EN-US" style="FONT-SIZE: 10.5pt; FONT-FAMILY: &quot;Times New Roman&quot;; mso-bidi-font-size: 12.0pt; mso-fareast-font-family: 宋体; mso-font-kerning: 1.0pt; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA">Closure</span><span style="FONT-SIZE: 10.5pt; FONT-FAMILY: 宋体; mso-hansi-font-family: &#39;Times New Roman&#39;; mso-ascii-font-family: &#39;Times New Roman&#39;; mso-bidi-font-family: &#39;Times New Roman&#39;; mso-bidi-font-size: 12.0pt; mso-font-kerning: 1.0pt; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA">）的实例。而</span><span lang="EN-US" style="FONT-SIZE: 10.5pt; FONT-FAMILY: &quot;Times New Roman&quot;; mso-bidi-font-size: 12.0pt; mso-fareast-font-family: 宋体; mso-font-kerning: 1.0pt; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA">C#2.0</span><span style="FONT-SIZE: 10.5pt; FONT-FAMILY: 宋体; mso-hansi-font-family: &#39;Times New Roman&#39;; mso-ascii-font-family: &#39;Times New Roman&#39;; mso-bidi-font-family: &#39;Times New Roman&#39;; mso-bidi-font-size: 12.0pt; mso-font-kerning: 1.0pt; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA">的迭代器就是一种特殊的封闭类型。
<br/></span></span></span></span></o:p></span></span></font></span>
</p></span></font></span></font></span></font></span></font></span></font></span></font></span></font></span></font></span></font></span></font></span></font></span></font></span></font></span></font><img src ="http://www.cnblogs.com/bluefee/aggbug/133501.html?type=1" width = "1" height = "1" /><br><br><a href="http://news.cnblogs.com/n/41929/" target="_blank">[新闻]阿里巴巴利润增1.36倍</a>]]></description></item><item><title>C#2.0-迭代器应用 [ 3 ]</title><link>http://www.cnblogs.com/bluefee/archive/2005/03/31/128983.html</link><dc:creator>Bluefee.Net</dc:creator><author>Bluefee.Net</author><pubDate>Thu, 31 Mar 2005 01:35:00 GMT</pubDate><guid>http://www.cnblogs.com/bluefee/archive/2005/03/31/128983.html</guid><wfw:comment>http://www.cnblogs.com/bluefee/comments/128983.html</wfw:comment><comments>http://www.cnblogs.com/bluefee/archive/2005/03/31/128983.html#Feedback</comments><slash:comments>3</slash:comments><wfw:commentRss>http://www.cnblogs.com/bluefee/comments/commentRss/128983.html</wfw:commentRss><trackback:ping>http://www.cnblogs.com/bluefee/services/trackbacks/128983.html</trackback:ping><description><![CDATA[摘要: 范型和迭代器在.NET Framework 2.0中IEnumerable和IEnumerator接口都提供了一种范型形态。 namespace&#160;System.Collections.Generic{&#160;&#160;&#160;&#160;[System.Runtime.InteropServices.ComVisibleAttribute(false)]&#160;&#160;&nbsp;&nbsp;<a href='http://www.cnblogs.com/bluefee/archive/2005/03/31/128983.html'>阅读全文</a><img src ="http://www.cnblogs.com/bluefee/aggbug/128983.html?type=1" width = "1" height = "1" /><br><br><a href="http://news.cnblogs.com/n/41928/" target="_blank">[新闻]Google Gears覆盖四大浏览器 Safari版推出</a>]]></description></item><item><title>3RD软件大餐</title><link>http://www.cnblogs.com/bluefee/archive/2005/03/30/128281.html</link><dc:creator>Bluefee.Net</dc:creator><author>Bluefee.Net</author><pubDate>Tue, 29 Mar 2005 16:21:00 GMT</pubDate><guid>http://www.cnblogs.com/bluefee/archive/2005/03/30/128281.html</guid><wfw:comment>http://www.cnblogs.com/bluefee/comments/128281.html</wfw:comment><comments>http://www.cnblogs.com/bluefee/archive/2005/03/30/128281.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.cnblogs.com/bluefee/comments/commentRss/128281.html</wfw:commentRss><trackback:ping>http://www.cnblogs.com/bluefee/services/trackbacks/128281.html</trackback:ping><description><![CDATA[<span style="COLOR: #000000"><span style="COLOR: #ff6600"><span style="COLOR: #ff6600">
<br/>Delphi2CS 2.2版发布</span></span> 
<br/>Netcoole发布了Delphi2CS 2.2版，这是一个将Delphi代码转换成C#代码的辅助工具 
<br/>更新日志： 
<br/>&#160; 支持*.bdsproj文件 
<br/>&#160; 支持*.dpk包 
<br/>&#160; 支持Class Helper 
<br/>&#160; 支持操作符重载 
<br/>&#160; 修复了一些bug 
<br/>下载地址：<a href="http://www.netcoole.com/delphi2cs.htm" target="_blank"><font color="#0000ff">http://www.netcoole.com/delphi2cs.htm 
<br/></font></a>
<br/><span style="COLOR: #ff6600">Log4net 1.2.9 Beta版发布</span> 
<br/>
<br/>这个我就不多说了 
<br/>下载地址：<a href="http://logging.apache.org/log4net/release/release-notes.html" target="_blank"><font color="#0000ff">http://logging.apache.org/log4net/release/release-notes.html</font></a>. 
<br/>
<br/></span><img src ="http://www.cnblogs.com/bluefee/aggbug/128281.html?type=1" width = "1" height = "1" /><br><br><a href="http://news.cnblogs.com/n/41927/" target="_blank">[新闻]Internet Explorer 8 Beta 2 发布</a>]]></description></item><item><title>C#2.0-迭代器应用 [ 2 ]</title><link>http://www.cnblogs.com/bluefee/archive/2005/03/29/128239.html</link><dc:creator>Bluefee.Net</dc:creator><author>Bluefee.Net</author><pubDate>Tue, 29 Mar 2005 14:29:00 GMT</pubDate><guid>http://www.cnblogs.com/bluefee/archive/2005/03/29/128239.html</guid><wfw:comment>http://www.cnblogs.com/bluefee/comments/128239.html</wfw:comment><comments>http://www.cnblogs.com/bluefee/archive/2005/03/29/128239.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.cnblogs.com/bluefee/comments/commentRss/128239.html</wfw:commentRss><trackback:ping>http://www.cnblogs.com/bluefee/services/trackbacks/128239.html</trackback:ping><description><![CDATA[<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt"><font size="3"><span lang="EN-US" style="COLOR: maroon"><font face="Times New Roman">C#2.0 </font></span><span style="COLOR: maroon; FONT-FAMILY: 宋体; mso-ascii-font-family: &#39;Times New Roman&#39;; mso-hansi-font-family: &#39;Times New Roman&#39;">迭代器</span><span lang="EN-US" style="COLOR: maroon"><o:p></o:p></span></font> 
</p>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt"><font size="3"><span style="COLOR: maroon; FONT-FAMILY: 宋体; mso-ascii-font-family: &#39;Times New Roman&#39;; mso-hansi-font-family: &#39;Times New Roman&#39;">关键字</span><span style="COLOR: maroon"><font face="Times New Roman"> </font></span><span lang="EN-US" style="COLOR: blue; FONT-FAMILY: Arial">yield return</span><b><span lang="EN-US" style="COLOR: #003366; FONT-FAMILY: Arial"><o:p></o:p></span></b></font> 
</p><span lang="EN-US" style="FONT-SIZE: 10.5pt; FONT-FAMILY: Arial; mso-bidi-font-size: 12.0pt; mso-font-kerning: 1.0pt; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA; mso-fareast-font-family: 宋体">C#2.0</span><span style="FONT-SIZE: 10.5pt; FONT-FAMILY: 宋体; mso-ascii-font-family: Arial; mso-hansi-font-family: Arial; mso-bidi-font-size: 12.0pt; mso-font-kerning: 1.0pt; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA; mso-bidi-font-family: Arial">通过强大的</span><span lang="EN-US" style="FONT-SIZE: 10.5pt; COLOR: blue; FONT-FAMILY: Arial; mso-bidi-font-size: 12.0pt; mso-font-kerning: 1.0pt; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA; mso-fareast-font-family: 宋体">yield return</span><span style="FONT-SIZE: 10.5pt; FONT-FAMILY: 宋体; mso-ascii-font-family: Arial; mso-hansi-font-family: Arial; mso-bidi-font-size: 12.0pt; mso-font-kerning: 1.0pt; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA; mso-bidi-font-family: Arial">关键字无缝实现了迭代器模式。特别是减轻了开发者实现一个枚举器和可枚举类的负担。这里我重写了一个前面的例子： 
<br/>
<br/>
<div style="BORDER-RIGHT: windowtext 0.5pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: windowtext 0.5pt solid; PADDING-LEFT: 5.4pt; BACKGROUND: #e6e6e6; PADDING-BOTTOM: 4px; BORDER-LEFT: windowtext 0.5pt solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: windowtext 0.5pt solid">
   <div><img height="16" src="http://www.cnblogs.com/images/OutliningIndicators/None.gif" width="11" align="top" /><span style="COLOR: #0000ff">using</span><span style="COLOR: #000000">&#160;System; 
<br/><img height="16" src="http://www.cnblogs.com/images/OutliningIndicators/None.gif" width="11" align="top" /></span><span style="COLOR: #0000ff">using</span><span style="COLOR: #000000">&#160;System.Collections; 
<br/><img height="16" src="http://www.cnblogs.com/images/OutliningIndicators/None.gif" width="11" align="top" /></span><span style="COLOR: #0000ff">public</span><span style="COLOR: #000000">&#160;</span><span style="COLOR: #0000ff">class</span><span style="COLOR: #000000">&#160;Persons&#160;:&#160;IEnumerable 
<br/><img id="Codehighlighter1_75_307_Open_Image" onclick="this.style.display=&#39;none&#39;; Codehighlighter1_75_307_Open_Text.style.display=&#39;none&#39;; Codehighlighter1_75_307_Closed_Image.style.display=&#39;inline&#39;; Codehighlighter1_75_307_Closed_Text.style.display=&#39;inline&#39;;" height="16" src="http://www.cnblogs.com/images/OutliningIndicators/ExpandedBlockStart.gif" width="11" align="top" /><img id="Codehighlighter1_75_307_Closed_Image" onclick="this.style.display=&#39;none&#39;; Codehighlighter1_75_307_Closed_Text.style.display=&#39;none&#39;; Codehighlighter1_75_307_Open_Image.style.display=&#39;inline&#39;; Codehighlighter1_75_307_Open_Text.style.display=&#39;inline&#39;;" height="16" src="http://www.cnblogs.com/images/OutliningIndicators/ContractedBlock.gif" width="11" align="top" style="DISPLAY: none" /></span><span id="Codehighlighter1_75_307_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img height="20" src="http://www.cnblogs.com/images/dot.gif" width="15" /></span><span id="Codehighlighter1_75_307_Open_Text"><span style="COLOR: #000000">{ 
<br/><img height="16" src="http://www.cnblogs.com/images/OutliningIndicators/InBlock.gif" width="11" align="top" />&#160;&#160;&#160;&#160;</span><span style="COLOR: #0000ff">string</span><span style="COLOR: #000000">[]&#160;m_Names; 
<br/><img height="16" src="http://www.cnblogs.com/images/OutliningIndicators/InBlock.gif" width="11" align="top" />&#160;&#160;&#160;&#160;</span><span style="COLOR: #0000ff">public</span><span style="COLOR: #000000">&#160;Persons(</span><span style="COLOR: #0000ff">params</span><span style="COLOR: #000000">&#160;</span><span style="COLOR: #0000ff">string</span><span style="COLOR: #000000">[]&#160;Names) 
<br/><img id="Codehighlighter1_136_204_Open_Image" onclick="this.style.display=&#39;none&#39;; Codehighlighter1_136_204_Open_Text.style.display=&#39;none&#39;; Codehighlighter1_136_204_Closed_Image.style.display=&#39;inline&#39;; Codehighlighter1_136_204_Closed_Text.style.display=&#39;inline&#39;;" height="16" src="http://www.cnblogs.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" width="11" align="top" /><img id="Codehighlighter1_136_204_Closed_Image" onclick="this.style.display=&#39;none&#39;; Codehighlighter1_136_204_Closed_Text.style.display=&#39;none&#39;; Codehighlighter1_136_204_Open_Image.style.display=&#39;inline&#39;; Codehighlighter1_136_204_Open_Text.style.display=&#39;inline&#39;;" height="16" src="http://www.cnblogs.com/images/OutliningIndicators/ContractedSubBlock.gif" width="11" align="top" style="DISPLAY: none" />&#160;&#160;&#160;&#160;</span><span id="Codehighlighter1_136_204_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img height="20" src="http://www.cnblogs.com/images/dot.gif" width="15" /></span><span id="Codehighlighter1_136_204_Open_Text"><span style="COLOR: #000000">{ 
<br/><img height="16" src="http://www.cnblogs.com/images/OutliningIndicators/InBlock.gif" width="11" align="top" />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;m_Names&#160;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">&#160;</span><span style="COLOR: #0000ff">new</span><span style="COLOR: #000000">&#160;</span><span style="COLOR: #0000ff">string</span><span style="COLOR: #000000">[Names.Length]; 
<br/><img height="16" src="http://www.cnblogs.com/images/OutliningIndicators/InBlock.gif" width="11" align="top" />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;Names.CopyTo(m_Names,</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">); 
<br/><img height="16" src="http://www.cnblogs.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" width="11" align="top" />&#160;&#160;&#160;&#160;}</span></span><span style="COLOR: #000000"> 
<br/><img height="16" src="http://www.cnblogs.com/images/OutliningIndicators/InBlock.gif" width="11" align="top" />&#160;&#160;&#160;&#160;</span><span style="COLOR: #0000ff">public</span><span style="COLOR: #000000">&#160;IEnumerator&#160;GetEnumerator() 
<br/><img id="Codehighlighter1_243_305_Open_Image" onclick="this.style.display=&#39;none&#39;; Codehighlighter1_243_305_Open_Text.style.display=&#39;none&#39;; Codehighlighter1_243_305_Closed_Image.style.display=&#39;inline&#39;; Codehighlighter1_243_305_Closed_Text.style.display=&#39;inline&#39;;" height="16" src="http://www.cnblogs.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" width="11" align="top" /><img id="Codehighlighter1_243_305_Closed_Image" onclick="this.style.display=&#39;none&#39;; Codehighlighter1_243_305_Closed_Text.style.display=&#39;none&#39;; Codehighlighter1_243_305_Open_Image.style.display=&#39;inline&#39;; Codehighlighter1_243_305_Open_Text.style.display=&#39;inline&#39;;" height="16" src="http://www.cnblogs.com/images/OutliningIndicators/ContractedSubBlock.gif" width="11" align="top" style="DISPLAY: none" />&#160;&#160;&#160;&#160;</span><span id="Codehighlighter1_243_305_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img height="20" src="http://www.cnblogs.com/images/dot.gif" width="15" /></span><span id="Codehighlighter1_243_305_Open_Text"><span style="COLOR: #000000">{ 
<br/><img height="16" src="http://www.cnblogs.com/images/OutliningIndicators/InBlock.gif" width="11" align="top" />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;</span><span style="COLOR: #0000ff">foreach</span><span style="COLOR: #000000">&#160;(</span><span style="COLOR: #0000ff">string</span><span style="COLOR: #000000">&#160;s&#160;</span><span style="COLOR: #0000ff">in</span><span style="COLOR: #000000">&#160;m_Names) 
<br/><img id="Codehighlighter1_279_302_Open_Image" onclick="this.style.display=&#39;none&#39;; Codehighlighter1_279_302_Open_Text.style.display=&#39;none&#39;; Codehighlighter1_279_302_Closed_Image.style.display=&#39;inline&#39;; Codehighlighter1_279_302_Closed_Text.style.display=&#39;inline&#39;;" height="16" src="http://www.cnblogs.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" width="11" align="top" /><img id="Codehighlighter1_279_302_Closed_Image" onclick="this.style.display=&#39;none&#39;; Codehighlighter1_279_302_Closed_Text.style.display=&#39;none&#39;; Codehighlighter1_279_302_Open_Image.style.display=&#39;inline&#39;; Codehighlighter1_279_302_Open_Text.style.display=&#39;inline&#39;;" height="16" src="http://www.cnblogs.com/images/OutliningIndicators/ContractedSubBlock.gif" width="11" align="top" style="DISPLAY: none" />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;</span><span id="Codehighlighter1_279_302_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img height="20" src="http://www.cnblogs.com/images/dot.gif" width="15" /></span><span id="Codehighlighter1_279_302_Open_Text"><span style="COLOR: #000000">{ 
<br/><img height="16" src="http://www.cnblogs.com/images/OutliningIndicators/InBlock.gif" width="11" align="top" />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;yield&#160;</span><span style="COLOR: #0000ff">return</span><span style="COLOR: #000000">&#160;s; 
<br/><img height="16" src="http://www.cnblogs.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" width="11" align="top" />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;}</span></span><span style="COLOR: #000000"> 
<br/><img height="16" src="http://www.cnblogs.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" width="11" align="top" />&#160;&#160;&#160;&#160;}</span></span><span style="COLOR: #000000"> 
<br/><img height="16" src="http://www.cnblogs.com/images/OutliningIndicators/ExpandedBlockEnd.gif" width="11" align="top" />}</span></span><span style="COLOR: #000000"> 
<br/><img height="16" src="http://www.cnblogs.com/images/OutliningIndicators/None.gif" width="11" align="top" /></span><span style="COLOR: #0000ff">class</span><span style="COLOR: #000000">&#160;Program 
<br/><img id="Codehighlighter1_323_532_Open_Image" onclick="this.style.display=&#39;none&#39;; Codehighlighter1_323_532_Open_Text.style.display=&#39;none&#39;; Codehighlighter1_323_532_Closed_Image.style.display=&#39;inline&#39;; Codehighlighter1_323_532_Closed_Text.style.display=&#39;inline&#39;;" height="16" src="http://www.cnblogs.com/images/OutliningIndicators/ExpandedBlockStart.gif" width="11" align="top" /><img id="Codehighlighter1_323_532_Closed_Image" onclick="this.style.display=&#39;none&#39;; Codehighlighter1_323_532_Closed_Text.style.display=&#39;none&#39;; Codehighlighter1_323_532_Open_Image.style.display=&#39;inline&#39;; Codehighlighter1_323_532_Open_Text.style.display=&#39;inline&#39;;" height="16" src="http://www.cnblogs.com/images/OutliningIndicators/ContractedBlock.gif" width="11" align="top" style="DISPLAY: none" /></span><span id="Codehighlighter1_323_532_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img height="20" src="http://www.cnblogs.com/images/dot.gif" width="15" /></span><span id="Codehighlighter1_323_532_Open_Text"><span style="COLOR: #000000">{ 
<br/><img height="16" src="http://www.cnblogs.com/images/OutliningIndicators/InBlock.gif" width="11" align="top" />&#160;&#160;&#160;&#160;</span><span style="COLOR: #0000ff">static</span><span style="COLOR: #000000">&#160;</span><span style="COLOR: #0000ff">void</span><span style="COLOR: #000000">&#160;Main(</span><span style="COLOR: #0000ff">string</span><span style="COLOR: #000000">[]&#160;args) 
<br/><img id="Codehighlighter1_359_530_Open_Image" onclick="this.style.display=&#39;none&#39;; Codehighlighter1_359_530_Open_Text.style.display=&#39;none&#39;; Codehighlighter1_359_530_Closed_Image.style.display=&#39;inline&#39;; Codehighlighter1_359_530_Closed_Text.style.display=&#39;inline&#39;;" height="16" src="http://www.cnblogs.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" width="11" align="top" /><img id="Codehighlighter1_359_530_Closed_Image" onclick="this.style.display=&#39;none&#39;; Codehighlighter1_359_530_Closed_Text.style.display=&#39;none&#39;; Codehighlighter1_359_530_Open_Image.style.display=&#39;inline&#39;; Codehighlighter1_359_530_Open_Text.style.display=&#39;inline&#39;;" height="16" src="http://www.cnblogs.com/images/OutliningIndicators/ContractedSubBlock.gif" width="11" align="top" style="DISPLAY: none" />&#160;&#160;&#160;&#160;</span><span id="Codehighlighter1_359_530_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img height="20" src="http://www.cnblogs.com/images/dot.gif" width="15" /></span><span id="Codehighlighter1_359_530_Open_Text"><span style="COLOR: #000000">{ 
<br/><img height="16" src="http://www.cnblogs.com/images/OutliningIndicators/InBlock.gif" width="11" align="top" />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;Persons&#160;arrPersons&#160;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">&#160;</span><span style="COLOR: #0000ff">new</span><span style="COLOR: #000000">&#160;Persons(&#8220;Michel&#8221;,&#8221;Christine&#8221;,&#8221;Mathieu&#8221;,&#8221;Julien&#8221;); 
<br/><img height="16" src="http://www.cnblogs.com/images/OutliningIndicators/InBlock.gif" width="11" align="top" />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;</span><span style="COLOR: #0000ff">foreach</span><span style="COLOR: #000000">&#160;(</span><span style="COLOR: #0000ff">string</span><span style="COLOR: #000000">&#160;s&#160;</span><span style="COLOR: #0000ff">in</span><span style="COLOR: #000000">&#160;arrPersons) 
<br/><img id="Codehighlighter1_475_527_Open_Image" onclick="this.style.display=&#39;none&#39;; Codehighlighter1_475_527_Open_Text.style.display=&#39;none&#39;; Codehighlighter1_475_527_Closed_Image.style.display=&#39;inline&#39;; Codehighlighter1_475_527_Closed_Text.style.display=&#39;inline&#39;;" height="16" src="http://www.cnblogs.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" width="11" align="top" /><img id="Codehighlighter1_475_527_Closed_Image" onclick="this.style.display=&#39;none&#39;; Codehighlighter1_475_527_Closed_Text.style.display=&#39;none&#39;; Codehighlighter1_475_527_Open_Image.style.display=&#39;inline&#39;; Codehighlighter1_475_527_Open_Text.style.display=&#39;inline&#39;;" height="16" src="http://www.cnblogs.com/images/OutliningIndicators/ContractedSubBlock.gif" width="11" align="top" style="DISPLAY: none" />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;</span><span id="Codehighlighter1_475_527_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img height="20" src="http://www.cnblogs.com/images/dot.gif" width="15" /></span><span id="Codehighlighter1_475_527_Open_Text"><span style="COLOR: #000000">{ 
<br/><img height="16" src="http://www.cnblogs.com/images/OutliningIndicators/InBlock.gif" width="11" align="top" />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;Console.WriteLine(s); 
<br/><img height="16" src="http://www.cnblogs.com/images/OutliningIndicators/InBlock.gif" width="11" align="top" />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;Console.ReadLine(); 
<br/><img height="16" src="http://www.cnblogs.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" width="11" align="top" />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;}</span></span><span style="COLOR: #000000"> 
<br/><img height="16" src="http://www.cnblogs.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" width="11" align="top" />&#160;&#160;&#160;&#160;}</span></span><span style="COLOR: #000000"> 
<br/><img height="16" src="http://www.cnblogs.com/images/OutliningIndicators/ExpandedBlockEnd.gif" width="11" align="top" />}</span></span><span style="COLOR: #000000"> 
<br/><img height="16" src="http://www.cnblogs.com/images/OutliningIndicators/None.gif" width="11" align="top" /></span> 
   </div>
</div>
<br/>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt"><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: Arial; mso-hansi-font-family: Arial; mso-bidi-font-family: Arial">别被</span><span lang="EN-US" style="COLOR: blue; FONT-FAMILY: Arial">yield return</span><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: Arial; mso-hansi-font-family: Arial; mso-bidi-font-family: Arial">关键字的行为所困扰。</span><span lang="EN-US" style="FONT-FAMILY: Arial">Yield return</span><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: Arial; mso-hansi-font-family: Arial; mso-bidi-font-family: Arial">关键字看起来像是返回了一个字符串但是实际上是通过调用</span><span lang="EN-US" style="FONT-FAMILY: Arial">GetEnumerator()</span><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: Arial; mso-hansi-font-family: Arial; mso-bidi-font-family: Arial">方法返回了</span><span lang="EN-US" style="FONT-FAMILY: Arial">Ienumerable</span><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: Arial; mso-hansi-font-family: Arial; mso-bidi-font-family: Arial">这个对象。既然我们不能明确的提供这样的实现，那么该由那个类实现</span><span lang="EN-US" style="FONT-FAMILY: Arial">IEnumerator</span><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: Arial; mso-hansi-font-family: Arial; mso-bidi-font-family: Arial">的返回呢。本文将对此展开讨论并深入到</span><span lang="EN-US" style="FONT-FAMILY: Arial">Csharp2.0</span><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: Arial; mso-hansi-font-family: Arial; mso-bidi-font-family: Arial">迭代器基本原理揭示这些神秘的东西。</span><span lang="EN-US" style="FONT-FAMILY: Arial"><o:p></o:p></span> 
</p><span style="FONT-SIZE: 10.5pt; FONT-FAMILY: 宋体; mso-ascii-font-family: Arial; mso-hansi-font-family: Arial; mso-bidi-font-size: 12.0pt; mso-font-kerning: 1.0pt; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA; mso-bidi-font-family: Arial">注意：方法能对</span><span lang="EN-US" style="FONT-SIZE: 10.5pt; COLOR: blue; FONT-FAMILY: Arial; mso-bidi-font-size: 12.0pt; mso-font-kerning: 1.0pt; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA; mso-fareast-font-family: 宋体">yield return</span><span style="FONT-SIZE: 10.5pt; FONT-FAMILY: 宋体; mso-ascii-font-family: Arial; mso-hansi-font-family: Arial; mso-bidi-font-size: 12.0pt; mso-font-kerning: 1.0pt; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA; mso-bidi-font-family: Arial">关键字多次调用</span><span lang="EN-US" style="FONT-SIZE: 10.5pt; FONT-FAMILY: Arial; mso-bidi-font-size: 12.0pt; mso-font-kerning: 1.0pt; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA; mso-fareast-font-family: 宋体">.</span><span style="FONT-SIZE: 10.5pt; FONT-FAMILY: 宋体; mso-ascii-font-family: Arial; mso-hansi-font-family: Arial; mso-bidi-font-size: 12.0pt; mso-font-kerning: 1.0pt; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA; mso-bidi-font-family: Arial">实例如下： 
<br/>
<br/>
<div style="BORDER-RIGHT: windowtext 0.5pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: windowtext 0.5pt solid; PADDING-LEFT: 5.4pt; BACKGROUND: #e6e6e6; PADDING-BOTTOM: 4px; BORDER-LEFT: windowtext 0.5pt solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: windowtext 0.5pt solid">
   <div><img height="16" src="http://www.cnblogs.com/images/OutliningIndicators/None.gif" width="11" align="top" /><span style="COLOR: #0000ff">using</span><span style="COLOR: #000000">&#160;System;&#160; 
<br/><img height="16" src="http://www.cnblogs.com/images/OutliningIndicators/None.gif" width="11" align="top" /></span><span style="COLOR: #0000ff">using</span><span style="COLOR: #000000">&#160;System.Collections;&#160; 
<br/><img height="16" src="http://www.cnblogs.com/images/OutliningIndicators/None.gif" width="11" align="top" /></span><span style="COLOR: #0000ff">public</span><span style="COLOR: #000000">&#160;</span><span style="COLOR: #0000ff">class</span><span style="COLOR: #000000">&#160;Persons&#160;:&#160;IEnumerable&#160; 
<br/><img id="Codehighlighter1_78_427_Open_Image" onclick="this.style.display=&#39;none&#39;; Codehighlighter1_78_427_Open_Text.style.display=&#39;none&#39;; Codehighlighter1_78_427_Closed_Image.style.display=&#39;inline&#39;; Codehighlighter1_78_427_Closed_Text.style.display=&#39;inline&#39;;" height="16" src="http://www.cnblogs.com/images/OutliningIndicators/ExpandedBlockStart.gif" width="11" align="top" /><img id="Codehighlighter1_78_427_Closed_Image" onclick="this.style.display=&#39;none&#39;; Codehighlighter1_78_427_Closed_Text.style.display=&#39;none&#39;; Codehighlighter1_78_427_Open_Image.style.display=&#39;inline&#39;; Codehighlighter1_78_427_Open_Text.style.display=&#39;inline&#39;;" height="16" src="http://www.cnblogs.com/images/OutliningIndicators/ContractedBlock.gif" width="11" align="top" style="DISPLAY: none" /></span><span id="Codehighlighter1_78_427_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img height="20" src="http://www.cnblogs.com/images/dot.gif" width="15" /></span><span id="Codehighlighter1_78_427_Open_Text"><span style="COLOR: #000000">{&#160; 
<br/><img height="16" src="http://www.cnblogs.com/images/OutliningIndicators/InBlock.gif" width="11" align="top" />&#160;&#160;&#160;&#160;</span><span style="COLOR: #0000ff">string</span><span style="COLOR: #000000">[]&#160;m_Names;&#160; 
<br/><img height="16" src="http://www.cnblogs.com/images/OutliningIndicators/InBlock.gif" width="11" align="top" />&#160;&#160;&#160;&#160;</span><span style="COLOR: #0000ff">public</span><span style="COLOR: #000000">&#160;Persons(</span><span style="COLOR: #0000ff">params</span><span style="COLOR: #000000">&#160;</span><span style="COLOR: #0000ff">string</span><span style="COLOR: #000000">[]&#160;Names)&#160; 
<br/><img id="Codehighlighter1_151_237_Open_Image" onclick="this.style.display=&#39;none&#39;; Codehighlighter1_151_237_Open_Text.style.display=&#39;none&#39;; Codehighlighter1_151_237_Closed_Image.style.display=&#39;inline&#39;; Codehighlighter1_151_237_Closed_Text.style.display=&#39;inline&#39;;" height="16" src="http://www.cnblogs.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" width="11" align="top" /><img id="Codehighlighter1_151_237_Closed_Image" onclick="this.style.display=&#39;none&#39;; Codehighlighter1_151_237_Closed_Text.style.display=&#39;none&#39;; Codehighlighter1_151_237_Open_Image.style.display=&#39;inline&#39;; Codehighlighter1_151_237_Open_Text.style.display=&#39;inline&#39;;" height="16" src="http://www.cnblogs.com/images/OutliningIndicators/ContractedSubBlock.gif" width="11" align="top" style="DISPLAY: none" />&#160;&#160;&#160;&#160;</span><span id="Codehighlighter1_151_237_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img height="20" src="http://www.cnblogs.com/images/dot.gif" width="15" /></span><span id="Codehighlighter1_151_237_Open_Text"><span style="COLOR: #000000">{&#160; 
<br/><img height="16" src="http://www.cnblogs.com/images/OutliningIndicators/InBlock.gif" width="11" align="top" />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;m_Names&#160;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">&#160;</span><span style="COLOR: #0000ff">new</span><span style="COLOR: #000000">&#160;</span><span style="COLOR: #0000ff">string</span><span style="COLOR: #000000">[Names.Length];&#160; 
<br/><img height="16" src="http://www.cnblogs.com/images/OutliningIndicators/InBlock.gif" width="11" align="top" />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;Names.CopyTo(m_Names,</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">);&#160; 
<br/><img height="16" src="http://www.cnblogs.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" width="11" align="top" />&#160;&#160;&#160;&#160;}</span></span><span style="COLOR: #000000">&#160; 
<br/><img height="16" src="http://www.cnblogs.com/images/OutliningIndicators/InBlock.gif" width="11" align="top" /> 
<br/><img height="16" src="http://www.cnblogs.com/images/OutliningIndicators/InBlock.gif" width="11" align="top" />&#160;&#160;&#160;&#160;</span><span style="COLOR: #0000ff">public</span><span style="COLOR: #000000">&#160;IEnumerator&#160;GetEnumerator()&#160; 
<br/><img id="Codehighlighter1_285_424_Open_Image" onclick="this.style.display=&#39;none&#39;; Codehighlighter1_285_424_Open_Text.style.display=&#39;none&#39;; Codehighlighter1_285_424_Closed_Image.style.display=&#39;inline&#39;; Codehighlighter1_285_424_Closed_Text.style.display=&#39;inline&#39;;" height="16" src="http://www.cnblogs.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" width="11" align="top" /><img id="Codehighlighter1_285_424_Closed_Image" onclick="this.style.display=&#39;none&#39;; Codehighlighter1_285_424_Closed_Text.style.display=&#39;none&#39;; Codehighlighter1_285_424_Open_Image.style.display=&#39;inline&#39;; Codehighlighter1_285_424_Open_Text.style.display=&#39;inline&#39;;" height="16" src="http://www.cnblogs.com/images/OutliningIndicators/ContractedSubBlock.gif" width="11" align="top" style="DISPLAY: none" />&#160;&#160;&#160;&#160;</span><span id="Codehighlighter1_285_424_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img height="20" src="http://www.cnblogs.com/images/dot.gif" width="15" /></span><span id="Codehighlighter1_285_424_Open_Text"><span style="COLOR: #000000">{&#160; 
<br/><img height="16" src="http://www.cnblogs.com/images/OutliningIndicators/InBlock.gif" width="11" align="top" />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;yield&#160;</span><span style="COLOR: #0000ff">return</span><span style="COLOR: #000000">&#160;</span><span style="COLOR: #000000">&quot;</span><span style="COLOR: #000000">Michel</span><span style="COLOR: #000000">&quot;</span><span style="COLOR: #000000">;&#160; 
<br/><img height="16" src="http://www.cnblogs.com/images/OutliningIndicators/InBlock.gif" width="11" align="top" />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;yield&#160;</span><span style="COLOR: #0000ff">return</span><span style="COLOR: #000000">&#160;</span><span style="COLOR: #000000">&quot;</span><span style="COLOR: #000000">Chirstine</span><span style="COLOR: #000000">&quot;</span><span style="COLOR: #000000">;&#160; 
<br/><img height="16" src="http://www.cnblogs.com/images/OutliningIndicators/InBlock.gif" width="11" align="top" />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;yield&#160;</span><span style="COLOR: #0000ff">return</span><span style="COLOR: #000000">&#160;</span><span style="COLOR: #000000">&quot;</span><span style="COLOR: #000000">Mathieu</span><span style="COLOR: #000000">&quot;</span><span style="COLOR: #000000">;&#160; 
<br/><img height="16" src="http://www.cnblogs.com/images/OutliningIndicators/InBlock.gif" width="11" align="top" />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;yield&#160;</span><span style="COLOR: #0000ff">return</span><span style="COLOR: #000000">&#160;</span><span style="COLOR: #000000">&quot;</span><span style="COLOR: #000000">Julien</span><span style="COLOR: #000000">&quot;</span><span style="COLOR: #000000">;&#160; 
<br/><img height="16" src="http://www.cnblogs.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" width="11" align="top" />&#160;&#160;&#160;&#160;}</span></span><span style="COLOR: #000000">&#160; 
<br/><img height="16" src="http://www.cnblogs.com/images/OutliningIndicators/ExpandedBlockEnd.gif" width="11" align="top" />}</span></span><span style="COLOR: #000000">&#160; 
<br/><img height="16" src="http://www.cnblogs.com/images/OutliningIndicators/None.gif" width="11" align="top" /></span><span style="COLOR: #0000ff">class</span><span style="COLOR: #000000">&#160;Program&#160; 
<br/><img id="Codehighlighter1_445_716_Open_Image" onclick="this.style.display=&#39;none&#39;; Codehighlighter1_445_716_Open_Text.style.display=&#39;none&#39;; Codehighlighter1_445_716_Closed_Image.style.display=&#39;inline&#39;; Codehighlighter1_445_716_Closed_Text.style.display=&#39;inline&#39;;" height="16" src="http://www.cnblogs.com/images/OutliningIndicators/ExpandedBlockStart.gif" width="11" align="top" /><img id="Codehighlighter1_445_716_Closed_Image" onclick="this.style.display=&#39;none&#39;; Codehighlighter1_445_716_Closed_Text.style.display=&#39;none&#39;; Codehighlighter1_445_716_Open_Image.style.display=&#39;inline&#39;; Codehighlighter1_445_716_Open_Text.style.display=&#39;inline&#39;;" height="16" src="http://www.cnblogs.com/images/OutliningIndicators/ContractedBlock.gif" width="11" align="top" style="DISPLAY: none" /></span><span id="Codehighlighter1_445_716_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img height="20" src="http://www.cnblogs.com/images/dot.gif" width="15" /></span><span id="Codehighlighter1_445_716_Open_Text"><span style="COLOR: #000000">{&#160; 
<br/><img height="16" src="http://www.cnblogs.com/images/OutliningIndicators/InBlock.gif" width="11" align="top" />&#160;&#160;&#160;&#160;</span><span style="COLOR: #0000ff">static</span><span style="COLOR: #000000">&#160;</span><span style="COLOR: #0000ff">void</span><span style="COLOR: #000000">&#160;Main(</span><span style="COLOR: #0000ff">string</span><span style="COLOR: #000000">[]&#160;args)&#160; 
<br/><img id="Codehighlighter1_489_713_Open_Image" onclick="this.style.display=&#39;none&#39;; Codehighlighter1_489_713_Open_Text.style.display=&#39;none&#39;; Codehighlighter1_489_713_Closed_Image.style.display=&#39;inline&#39;; Codehighlighter1_489_713_Closed_Text.style.display=&#39;inline&#39;;" height="16" src="http://www.cnblogs.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" width="11" align="top" /><img id="Codehighlighter1_489_713_Closed_Image" onclick="this.style.display=&#39;none&#39;; Codehighlighter1_489_713_Closed_Text.style.display=&#39;none&#39;; Codehighlighter1_489_713_Open_Image.style.display=&#39;inline&#39;; Codehighlighter1_489_713_Open_Text.style.display=&#39;inline&#39;;" height="16" src="http://www.cnblogs.com/images/OutliningIndicators/ContractedSubBlock.gif" width="11" align="top" style="DISPLAY: none" />&#160;&#160;&#160;&#160;</span><span id="Codehighlighter1_489_713_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img height="20" src="http://www.cnblogs.com/images/dot.gif" width="15" /></span><span id="Codehighlighter1_489_713_Open_Text"><span style="COLOR: #000000">{&#160; 
<br/><img height="16" src="http://www.cnblogs.com/images/OutliningIndicators/InBlock.gif" width="11" align="top" />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;Persons&#160;arrPersons&#160;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">&#160;</span><span style="COLOR: #0000ff">new</span><span style="COLOR: #000000">&#160;Persons(</span><span style="COLOR: #000000">&quot;</span><span style="COLOR: #000000">Michel</span><span style="COLOR: #000000">&quot;</span><span style="COLOR: #000000">,</span><span style="COLOR: #000000">&quot;</span><span style="COLOR: #000000">Christine</span><span style="COLOR: #000000">&quot;</span><span style="COLOR: #000000">,</span><span style="COLOR: #000000">&quot;</span><span style="COLOR: #000000">Mathieu</span><span style="COLOR: #000000">&quot;</span><span style="COLOR: #000000">,</span><span style="COLOR: #000000">&quot;</span><span style="COLOR: #000000">Julien</span><span style="COLOR: #000000">&quot;</span><span style="COLOR: #000000">);&#160; 
<br/><img height="16" src="http://www.cnblogs.com/images/OutliningIndicators/InBlock.gif" width="11" align="top" />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;</span><span style="COLOR: #0000ff">foreach</span><span style="COLOR: #000000">&#160;(</span><span style="COLOR: #0000ff">string</span><span style="COLOR: #000000">&#160;s&#160;</span><span style="COLOR: #0000ff">in</span><span style="COLOR: #000000">&#160;arrPersons)&#160; 
<br/><img id="Codehighlighter1_626_706_Open_Image" onclick="this.style.display=&#39;none&#39;; Codehighlighter1_626_706_Open_Text.style.display=&#39;none&#39;; Codehighlighter1_626_706_Closed_Image.style.display=&#39;inline&#39;; Codehighlighter1_626_706_Closed_Text.style.display=&#39;inline&#39;;" height="16" src="http://www.cnblogs.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" width="11" align="top" /><img id="Codehighlighter1_626_706_Closed_Image" onclick="this.style.display=&#39;none&#39;; Codehighlighter1_626_706_Closed_Text.style.display=&#39;none&#39;; Codehighlighter1_626_706_Open_Image.style.display=&#39;inline&#39;; Codehighlighter1_626_706_Open_Text.style.display=&#39;inline&#39;;" height="16" src="http://www.cnblogs.com/images/OutliningIndicators/ContractedSubBlock.gif" width="11" align="top" style="DISPLAY: none" />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;</span><span id="Codehighlighter1_626_706_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img height="20" src="http://www.cnblogs.com/images/dot.gif" width="15" /></span><span id="Codehighlighter1_626_706_Open_Text"><span style="COLOR: #000000">{&#160; 
<br/><img height="16" src="http://www.cnblogs.com/images/OutliningIndicators/InBlock.gif" width="11" align="top" />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;Console.WriteLine(s);&#160; 
<br/><img height="16" src="http://www.cnblogs.com/images/OutliningIndicators/InBlock.gif" width="11" align="top" />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;Console.ReadLine();&#160; 
<br/><img height="16" src="http://www.cnblogs.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" width="11" align="top" />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;}</span></span><span style="COLOR: #000000">&#160; 
<br/><img height="16" src="http://www.cnblogs.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" width="11" align="top" />&#160;&#160;&#160;&#160;}</span></span><span style="COLOR: #000000">&#160; 
<br/><img height="16" src="http://www.cnblogs.com/images/OutliningIndicators/ExpandedBlockEnd.gif" width="11" align="top" />}</span></span><span style="COLOR: #000000">&#160; 
<br/><img height="16" src="http://www.cnblogs.com/images/OutliningIndicators/None.gif" width="11" align="top" /></span> 
   </div>
</div>
<br/>
<br/>
<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 21pt"><span style="FONT-FAMILY: 宋体; mso-ascii-font-family: &#39;Times New Roman&#39;; mso-hansi-font-family: &#39;Times New Roman&#39;">这段程序将同样产生以下输出</span> 
</p><strong><span lang="EN-US" style="FONT-SIZE: 10.5pt; FONT-FAMILY: &#39;Times New Roman&#39;; mso-bidi-font-size: 12.0pt; mso-font-kerning: 1.0pt; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA; mso-fareast-font-family: 宋体">&#160;&#160;&#160;&#160;&#160;&#160; Michel </span></strong><b><span lang="EN-US" style="FONT-SIZE: 10.5pt; FONT-FAMILY: &#39;Times New Roman&#39;; mso-bidi-font-size: 12.0pt; mso-font-kerning: 1.0pt; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA; mso-fareast-font-family: 宋体">
<br/><strong>&#160;&#160;&#160;&#160;&#160;&#160; Christine</strong> 
<br/><strong>&#160;&#160;&#160;&#160;&#160;&#160; Mathieu&#160;</strong> 
<br/><strong>&#160;&#160;&#160;&#160;&#160;&#160;Julien 
<br/></strong></span></b>
<br/>未完待续。。。。。 
<br/></span></span><img src ="http://www.cnblogs.com/bluefee/aggbug/128239.html?type=1" width = "1" height = "1" /><br><br><a href="http://news.cnblogs.com/n/41924/" target="_blank">[新闻]中国软件协会：SAP羞辱国产软件是不正当竞争</a>]]></description></item><item><title>C#2.0-迭代器应用 [ 1 ]</title><link>http://www.cnblogs.com/bluefee/archive/2005/03/28/127455.html</link><dc:creator>Bluefee.Net</dc:creator><author>Bluefee.Net</author><pubDate>Mon, 28 Mar 2005 13:22:00 GMT</pubDate><guid>http://www.cnblogs.com/bluefee/archive/2005/03/28/127455.html</guid><wfw:comment>http://www.cnblogs.com/bluefee/comments/127455.html</wfw:comment><comments>http://www.cnblogs.com/bluefee/archive/2005/03/28/127455.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.cnblogs.com/bluefee/comments/commentRss/127455.html</wfw:commentRss><trackback:ping>http://www.cnblogs.com/bluefee/services/trackbacks/127455.html</trackback:ping><description><![CDATA[摘要: [翻译+补充说明]&#160; 原文参考：http://www.theserverside.net/articles/showarticle.tss?id=IteratorsWithC2 注释：对于Enumerable和Enumerator的翻译可能不太贴切 可以参考以下词汇：枚举 枚举构造器 介绍 &#160; 迭代器作为匿名方法存在是很不明显的，但是其强大的特性现在被引入到Csharp2.0版&nbsp;&nbsp;<a href='http://www.cnblogs.com/bluefee/archive/2005/03/28/127455.html'>阅读全文</a><img src ="http://www.cnblogs.com/bluefee/aggbug/127455.html?type=1" width = "1" height = "1" /><br><br><a href="http://news.cnblogs.com/n/41923/" target="_blank">[新闻]福布斯：Facebook网站十大最火爆游戏</a>]]></description></item><item><title>Inside IIS And ASP.NET [ 4 ]</title><link>http://www.cnblogs.com/bluefee/archive/2005/03/28/127278.html</link><dc:creator>Bluefee.Net</dc:creator><author>Bluefee.Net</author><pubDate>Mon, 28 Mar 2005 08:11:00 GMT</pubDate><guid>http://www.cnblogs.com/bluefee/archive/2005/03/28/127278.html</guid><wfw:comment>http://www.cnblogs.com/bluefee/comments/127278.html</wfw:comment><comments>http://www.cnblogs.com/bluefee/archive/2005/03/28/127278.html#Feedback</comments><slash:comments>3</slash:comments><wfw:commentRss>http://www.cnblogs.com/bluefee/comments/commentRss/127278.html</wfw:commentRss><trackback:ping>http://www.cnblogs.com/bluefee/services/trackbacks/127278.html</trackback:ping><description><![CDATA[<span style="COLOR: red">实现IHttpHandlerFactory接口
<br/></span>对于在何处响应对指定资源的请求Http Handler也许是有用的，Http处理工厂使得有可能在请求的一些预处理任务中截取请求信息，下面的一个工厂模式创建了一个资源处理器。
<br/>创建一个自定义处理工厂意味着创建了一个实现了IHttpHandlerFactory接口的.Net组件，这个接口具有以下成员：
<br/><strong>GetHandler()</strong>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 这个方法为运行时处理对资源的请求操作创建了一个IHttpHandler的接口类型；
<br/><strong>ReleaseHandler()</strong>&#160;&#160;&#160;&#160;&#160;这个方法提供了一个机会使得可以释放一个接口类型并为下次重用处理器对象作准备。
<br/>GetHandler()方法通过运行时调用，并且只有2种返回值；Null和正确的IHttpHander接口类型。这有一个Http处理器工厂的例子展示了对于特定IP的客户端的计数统计，如果计数器超出限制那么返回一个自定义的处理器（Handler），反之对这些资源的请求传递控件到默认的处理器（Handler）。
<br/>
<br/><strong><font color="#0000ff">public class</font> HitTrackingHandlerFactory: IHttpHandlerFactory
<br/>{
<br/>&#160;&#160; <font color="#0000ff">public</font> HitTrackingHandlerFactory()
<br/>&#160;&#160; {
<br/>&#160;&#160; }
<br/>
<br/>&#160;&#160; <font color="#0000ff">public virtual</font> IHttpHandler GetHandler(HttpContext context, 
<br/>&#160;&#160;&#160;&#160; String requestType, String url, String pathTranslated)
<br/>&#160;&#160; {
<br/>
<br/>&#160;&#160;&#160;&#160; <font color="#0000ff">if</font> (!HitLogHelper.CheckHitCount(context.Request.UserHostAddress, context.Request.UserHostName))
<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160; <font color="#0000ff">return new</font> HitsExceededHandler();
<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160; 
<br/>&#160;&#160;&#160;&#160; Object handler = <font color="#0000ff">null</font>;
<br/>&#160;&#160; 
<br/>&#160;&#160;&#160;&#160; <font color="#0000ff">try</font> 
<br/>&#160;&#160;&#160;&#160; {
<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160; String filename = url.Substring(url.LastIndexOf(&#39;/&#39;)+1);
<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160; String file = filename.Substring(0, filename.IndexOf(&#39;.&#39;));
<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160; String ext = filename.Substring(filename.LastIndexOf(&#39;.&#39;)+1);
<br/>
<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160; <font color="#0000ff">if</font> (ext == &quot;aspx&quot;)
<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160; {
<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <font color="#0000ff">return</font> System.Web.UI.PageParser.GetCompiledPageInstance(url, pathTranslated, context);
<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160; }
<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160; <font color="#0000ff">else if </font>(ext == &quot;asmx&quot;)
<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160; {
<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; System.Web.Services.Protocols.WebServiceHandlerFactory fact = <font color="#0000ff">new</font>
<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;System.Web.Services.Protocols.WebServiceHandlerFactory();
<br/>&#160;&#160;&#160;&#160; 
<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; handler = fact.GetHandler(context, context.Request.RequestType, url, pathTranslated);
<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160; }
<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160; <font color="#0000ff">else if</font> (ext == &quot;rem&quot;)
<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160; {
<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; System.Runtime.Remoting.Channels.Http.HttpRemotingHandlerFactory fact = <font color="#0000ff">new</font>
<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;System.Runtime.Remoting.Channels.Http.HttpRemotingHandlerFactory();
<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; handler = fact.GetHandler(context, context.Request.RequestType, url, pathTranslated);
<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160; }
<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160; <font color="#0000ff">else</font>
<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160; {
<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <font color="#0000ff">throw new</font> HttpException(&quot;Unable to process extension *.&quot; + ext);
<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160; }
<br/>
<br/>&#160;&#160;&#160;&#160; }
<br/>&#160;&#160;&#160;&#160; <font color="#0000ff">catch</font> (Exception e)
<br/>&#160;&#160;&#160;&#160; {
<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160; <font color="#0000ff">throw new</font> HttpException(&quot;HitTrackingHandlerFactory&quot;, e);
<br/>&#160;&#160;&#160;&#160; }
<br/>&#160;&#160;&#160;&#160; <font color="#0000ff">return</font> (IHttpHandler)handler;
<br/>&#160;&#160; }
<br/>
<br/>
<br/>&#160;&#160; <font color="#0000ff">public virtual void</font> ReleaseHandler(IHttpHandler handler)
<br/>&#160;&#160; {
<br/>&#160;&#160;&#160;&#160; <font color="#0000ff">return</font>;
<br/>&#160;&#160; }
<br/>}
<br/>
<br/><font color="#0000ff">public class</font> HitsExceededHandler: IHttpHandler
<br/>{
<br/>&#160;&#160; <font color="#0000ff">public</font> HitsExceededHandler()
<br/>&#160;&#160; {
<br/>&#160;&#160; }
<br/>
<br/>&#160;&#160; <font color="#0000ff">public virtual void</font> ProcessRequest(HttpContext context)
<br/>&#160;&#160; {
<br/>&#160;&#160;&#160;&#160; context.Response.Write(&quot;&lt;h1&gt;Number of hits exceeded!&lt;/h1&gt;&lt;p&gt;&quot;);
<br/>&#160;&#160; }
<br/>&#160;&#160;&#160; 
<br/>&#160;&#160; <font color="#0000ff">public virtual bool</font> IsReusable
<br/>&#160;&#160; {
<br/>&#160;&#160;&#160;&#160; <font color="#0000ff">get</font> { <font color="#0000ff">return true</font>; }
<br/>&#160;&#160; }
<br/>}</strong>
<br/>
<br/><span style="COLOR: red">实现IHttpModule接口</span>
<br/>模块提供了一种与应用程序事件以及HTTP请求和响应对象交互的事件驱动模式。注册模块是在Http处理器和处理工厂前被实例化的，所以自身能够注册（绑定）应用程序事件。事实上，模块与Web应用程序通过两种方式组合：监听应用程序事件并且触发与之绑定的应用程序事件的自定义事件。后者与应用程序模块紧密结合。在一个组件的独立部分，提交域（former）提供了访问Http请求、响应、会话状态对象的多种方式。
<br/>创建一个自定义模块意味着创建一个实现IHttpModule接口的.Net组件，这个接口具有以下成员：
<br/>Init()&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;提供了一个为模块注册（绑定）应用程序事件的恰当时机。
<br/>Dispose()&#160;&#160;&#160; 提供了一个清除对资源分派（对象）的恰当时机。
<br/>在下面这个例子种，Init()方法为HttpApplication对象注册（绑定）了PreRequestHandlerExecute, PostRequestHandlerExecute, and Error事件。
<br/>
<br/><strong>protected void Init() 
<br/>{
<br/>&#160; application.PreRequestHandlerExecute += 
<br/>(new EventHandler(this.Application_PreRequestHandlerExecute));&#160; 
<br/>&#160;&#160; application.PostRequestHandlerExecute += 
<br/>(new EventHandler(this.Application_PostRequestHandlerExecute)); 
<br/>&#160;&#160; application.Error += (new EventHandler(this.Application_Error));
<br/>}</strong>
<br/>
<br/>你也可以在Global.asax文件中对一个独立应用程序进行这些事件处理。无论怎样，使用模块使得能够配置多个应用程序处理的通用化的事件集合。
<br/><strong>&lt;httpModules&gt;
<br/>&#160;&#160; &lt;add <font color="#ff0000">name</font>=&quot;EventModule&quot; <font color="#ff0000">type</font>=&quot;WebHandlers.EventModule,WebHandlers&quot;/&gt;
<br/>&#160;&#160; &lt;add <font color="#ff0000">name</font>=&quot;ErrorHandlerModule&quot; <font color="#ff0000">type</font>=&quot;WebHandlers.ErrorHandlerModule,WebHandlers&quot;/&gt;
<br/>&lt;/httpModules&gt;
<br/></strong>在这个全局错误处理器(Global Error Handler)中，你能够提供一种捕获所有错误操作并且提示站点管理者一些未捕获异常信息的方式。
<br/>
<br/><span style="COLOR: red">处理器与模块</span>
<br/>从架构的角度看，处理器和模块有着不同的用途。处理器（包括处理工厂方法调用返回的处理器）提供了一种截获请求以及如何改变请求（请求路由）的途径。模块对于以上方法一样可以做到，并且可以发送自定义的响应以及取消这些任务的操作。这些使得他们具有了访问HttpApplication,HttpReuqst,HttpResponse,HttpSessionState对象的能力以便你能够熟练的与数据进行交互。
<br/>以下是组件事件发生的顺序：
<br/>1、HttpApplication对象被创建（如果需要）
<br/>2、HttpModule对象被创建（以配置文件中声明的次序）
<br/>3、模块接收请求并且验证请求的正确性，之后优先的控件将会先传递给处理器处理
<br/>4、返回的对象被创建（如：Page, Web Service&#160;或 Remote object）
<br/>5、这些对象，应用程序以及模块继续通过其他的事件彼此交互
<br/>下面的图标阐明了这个过程以及它们实例化的次序：
<br/><img height="280" src="http://www.cnblogs.com/images/cnblogs_com/bluefee/image06.jpg" width="477" />
<br/>接下来的图表阐明了处理工厂，处理器以及其他扩张在整个工作流程中的位置：
<br/><img height="279" src="http://www.cnblogs.com/images/cnblogs_com/bluefee/image07.jpg" width="479" />
<br/>
<br/>
<br/>全文完！
<br/>
<br/><img src ="http://www.cnblogs.com/bluefee/aggbug/127278.html?type=1" width = "1" height = "1" /><br><br><a href="http://news.cnblogs.com/n/41923/" target="_blank">[新闻]福布斯：Facebook网站十大最火爆游戏</a>]]></description></item><item><title>Inside IIS And ASP.NET [ 3 ]</title><link>http://www.cnblogs.com/bluefee/archive/2005/03/28/127032.html</link><dc:creator>Bluefee.Net</dc:creator><author>Bluefee.Net</author><pubDate>Mon, 28 Mar 2005 02:37:00 GMT</pubDate><guid>http://www.cnblogs.com/bluefee/archive/2005/03/28/127032.html</guid><wfw:comment>http://www.cnblogs.com/bluefee/comments/127032.html</wfw:comment><comments>http://www.cnblogs.com/bluefee/archive/2005/03/28/127032.html#Feedback</comments><slash:comments>4</slash:comments><wfw:commentRss>http://www.cnblogs.com/bluefee/comments/commentRss/127032.html</wfw:commentRss><trackback:ping>http://www.cnblogs.com/bluefee/services/trackbacks/127032.html</trackback:ping><description><![CDATA[<p><span style="COLOR: #000000"><span style="COLOR: #ff0000"><span style="COLOR: #ff0000">实现IHttpHandler接口</span></span> 
<br/>与ISAPI扩展类似的是处理器提供了低层次的访问HTTP请求与响应对象的方式。实现一个自定义处理器允许处理你所指定的某种不同的资源请求。你可以在请求过程中截取请求并且重载对它的响应。举例来说，假如你希望记录那些对服务端禁止访问文件发出请求的客户端IP地址，那么你可以写一个自定义的处理器在这些受拒绝的请求被抛出异常之前记录所需要的信息。你可能想要为这些请求发送一些热情洋溢的文字，以下代码展示了这些： 
<br/>
<br/><img height="309" src="http://www.cnblogs.com/images/cnblogs_com/bluefee/image05.jpg" width="478" /> 
<br/>
<br/>创建一个自定义处理器意味着需要创建一个.NET组件并且实现IHttpHandler接口，这个接口有以下成员： 
<br/></span><span style="COLOR: #000000">
<br/><strong>ProcessRequest()</strong>&#160;&#160;&#160; 这个方法调用运行时来处理请求 
<br/><strong>IsReusable</strong>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 这个属性指出如果有多个请求那么将共享同一个(处理器)Handler 
<br/>
<br/>ProcessRequest()对于请求会传递一个HttpContext对象，通常在处理请求时会用到HttpRequest,HttpResponse,HttpSessionState对象。 
<br/><strong>注释：如果希望访问Session对象那么就必须实现IRequiresSessionState接口 
<br/>
<br/></strong>这有个HttpHandler的简单例子，它只是输出一些文字到浏览器 
<br/>
   <div style="BORDER-RIGHT: windowtext 0.5pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: windowtext 0.5pt solid; PADDING-LEFT: 5.4pt; BACKGROUND: #e6e6e6; PADDING-BOTTOM: 4px; BORDER-LEFT: windowtext 0.5pt solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: windowtext 0.5pt solid">
       <div><img height="16" src="http://www.cnblogs.com/images/OutliningIndicators/None.gif" width="11" align="top" /><span style="COLOR: #0000ff">public</span><span style="COLOR: #000000">&#160;</span><span style="COLOR: #0000ff">class</span><span style="COLOR: #000000">&#160;ForbiddenLogHandler:&#160;IHttpHandler 
<br/><img id="Codehighlighter1_47_671_Open_Image" onclick="this.style.display=&#39;none&#39;; Codehighlighter1_47_671_Open_Text.style.display=&#39;none&#39;; Codehighlighter1_47_671_Closed_Image.style.display=&#39;inline&#39;; Codehighlighter1_47_671_Closed_Text.style.display=&#39;inline&#39;;" height="16" src="http://www.cnblogs.com/images/OutliningIndicators/ExpandedBlockStart.gif" width="11" align="top" /><img id="Codehighlighter1_47_671_Closed_Image" onclick="this.style.display=&#39;none&#39;; Codehighlighter1_47_671_Closed_Text.style.display=&#39;none&#39;; Codehighlighter1_47_671_Open_Image.style.display=&#39;inline&#39;; Codehighlighter1_47_671_Open_Text.style.display=&#39;inline&#39;;" height="16" src="http://www.cnblogs.com/images/OutliningIndicators/ContractedBlock.gif" width="11" align="top" style="DISPLAY: none" /></span><span id="Codehighlighter1_47_671_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img height="20" src="http://www.cnblogs.com/images/dot.gif" width="15" /></span><span id="Codehighlighter1_47_671_Open_Text"><span style="COLOR: #000000">{ 
<br/><img height="16" src="http://www.cnblogs.com/images/OutliningIndicators/InBlock.gif" width="11" align="top" />&#160;&#160;</span><span style="COLOR: #0000ff">public</span><span style="COLOR: #000000">&#160;ForbiddenLogHandler() 
<br/><img id="Codehighlighter1_82_86_Open_Image" onclick="this.style.display=&#39;none&#39;; Codehighlighter1_82_86_Open_Text.style.display=&#39;none&#39;; Codehighlighter1_82_86_Closed_Image.style.display=&#39;inline&#39;; Codehighlighter1_82_86_Closed_Text.style.display=&#39;inline&#39;;" height="16" src="http://www.cnblogs.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" width="11" align="top" /><img id="Codehighlighter1_82_86_Closed_Image" onclick="this.style.display=&#39;none&#39;; Codehighlighter1_82_86_Closed_Text.style.display=&#39;none&#39;; Codehighlighter1_82_86_Open_Image.style.display=&#39;inline&#39;; Codehighlighter1_82_86_Open_Text.style.display=&#39;inline&#39;;" height="16" src="http://www.cnblogs.com/images/OutliningIndicators/ContractedSubBlock.gif" width="11" align="top" style="DISPLAY: none" />&#160;&#160;</span><span id="Codehighlighter1_82_86_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img height="20" src="http://www.cnblogs.com/images/dot.gif" width="15" /></span><span id="Codehighlighter1_82_86_Open_Text"><span style="COLOR: #000000">{ 
<br/><img height="16" src="http://www.cnblogs.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" width="11" align="top" />&#160;&#160;}</span></span><span style="COLOR: #000000"> 
<br/><img height="16" src="http://www.cnblogs.com/images/OutliningIndicators/InBlock.gif" width="11" align="top" />&#160;&#160;</span><span style="COLOR: #0000ff">public</span><span style="COLOR: #000000">&#160;</span><span style="COLOR: #0000ff">virtual</span><span style="COLOR: #000000">&#160;</span><span style="COLOR: #0000ff">void</span><span style="COLOR: #000000">&#160;ProcessRequest(HttpContext&#160;context) 
<br/><img id="Codehighlighter1_148_604_Open_Image" onclick="this.style.display=&#39;none&#39;; Codehighlighter1_148_604_Open_Text.style.display=&#39;none&#39;; Codehighlighter1_148_604_Closed_Image.style.display=&#39;inline&#39;; Codehighlighter1_148_604_Closed_Text.style.display=&#39;inline&#39;;" height="16" src="http://www.cnblogs.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" width="11" align="top" /><img id="Codehighlighter1_148_604_Closed_Image" onclick="this.style.display=&#39;none&#39;; Codehighlighter1_148_604_Closed_Text.style.display=&#39;none&#39;; Codehighlighter1_148_604_Open_Image.style.display=&#39;inline&#39;; Codehighlighter1_148_604_Open_Text.style.display=&#39;inline&#39;;" height="16" src="http://www.cnblogs.com/images/OutliningIndicators/ContractedSubBlock.gif" width="11" align="top" style="DISPLAY: none" />&#160;&#160;</span><span id="Codehighlighter1_148_604_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img height="20" src="http://www.cnblogs.com/images/dot.gif" width="15" /></span><span id="Codehighlighter1_148_604_Open_Text"><span style="COLOR: #000000">{ 
<br/><img height="16" src="http://www.cnblogs.com/images/OutliningIndicators/InBlock.gif" width="11" align="top" />&#160;&#160;&#160;&#160;context.Trace.Write(</span><span style="COLOR: #000000">&quot;</span><span style="COLOR: #000000">ForbiddenLogHandler.ProcessRequest()</span><span style="COLOR: #000000">&quot;</span><span style="COLOR: #000000">); 
<br/><img height="16" src="http://www.cnblogs.com/images/OutliningIndicators/InBlock.gif" width="11" align="top" />&#160;&#160;&#160;&#160;HttpResponse&#160;rs&#160;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">&#160;context.Response; 
<br/><img height="16" src="http://www.cnblogs.com/images/OutliningIndicators/InBlock.gif" width="11" align="top" />&#160;&#160;&#160;&#160;HttpRequest&#160;rq&#160;</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">&#160;context.Request; 
<br/><img height="16" src="http://www.cnblogs.com/images/OutliningIndicators/InBlock.gif" width="11" align="top" />&#160;&#160;&#160;&#160;rs.Write(</span><span style="COLOR: #000000">&quot;</span><span style="COLOR: #000000">&lt;p&gt;&lt;H1&gt;We&#160;know&#160;who&#160;you&#160;are<img height="20" src="http://www.cnblogs.com/images/dot.gif" width="15" />&lt;/H1&gt;&lt;/p&gt;</span><span style="COLOR: #000000">&quot;</span><span style="COLOR: #000000">); 
<br/><img height="16" src="http://www.cnblogs.com/images/OutliningIndicators/InBlock.gif" width="11" align="top" />&#160;&#160;&#160;&#160;rs.Write(</span><span style="COLOR: #000000">&quot;</span><span style="COLOR: #000000">You&#160;were&#160;referred&#160;by&#160;</span><span style="COLOR: #000000">&quot;</span><span style="COLOR: #000000">&#160;</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">&#160;rq.UrlReferrer&#160;</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">&#160;</span><span style="COLOR: #000000">&quot;</span><span style="COLOR: #000000">&lt;br&gt;</span><span style="COLOR: #000000">&quot;</span><span style="COLOR: #000000">); 
<br/><img height="16" src="http://www.cnblogs.com/images/OutliningIndicators/InBlock.gif" width="11" align="top" />&#160;&#160;&#160;&#160;rs.Write(</span><span style="COLOR: #000000">&quot;</span><span style="COLOR: #000000">Your&#160;IP&#160;is</span><span style="COLOR: #000000">&quot;</span><span style="COLOR: #000000">&#160;</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">&#160;rq.UserHostAddress&#160;</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">&#160;</span><span style="COLOR: #000000">&quot;</span><span style="COLOR: #000000">&lt;br&gt;</span><span style="COLOR: #000000">&quot;</span><span style="COLOR: #000000">); 
<br/><img height="16" src="http://www.cnblogs.com/images/OutliningIndicators/InBlock.gif" width="11" align="top" />&#160;&#160;&#160;&#160;rs.Write(</span><span style="COLOR: #000000">&quot;</span><span style="COLOR: #000000">Your&#160;domain&#160;is</span><span style="COLOR: #000000">&quot;</span><span style="COLOR: #000000">&#160;</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">&#160;rq.UserHostName&#160;</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">&#160;</span><span style="COLOR: #000000">&quot;</span><span style="COLOR: #000000">&lt;br&gt;</span><span style="COLOR: #000000">&quot;</span><span style="COLOR: #000000">); 
<br/><img height="16" src="http://www.cnblogs.com/images/OutliningIndicators/InBlock.gif" width="11" align="top" />&#160;&#160;&#160;&#160;rs.Write(</span><span style="COLOR: #000000">&quot;</span><span style="COLOR: #000000">&lt;p&gt;Why&#160;were&#160;you&#160;requesting&#160;a&#160;restricted&#160;resource?&lt;/p&gt;</span><span style="COLOR: #000000">&quot;</span><span style="COLOR: #000000">); 
<br/><img height="16" src="http://www.cnblogs.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" width="11" align="top" />&#160;&#160;}</span></span><span style="COLOR: #000000"> 
<br/><img height="16" src="http://www.cnblogs.com/images/OutliningIndicators/InBlock.gif" width="11" align="top" />&#160;&#160;</span><span style="COLOR: #0000ff">public</span><span style="COLOR: #000000">&#160;</span><span style="COLOR: #0000ff">virtual</span><span style="COLOR: #000000">&#160;</span><span style="COLOR: #0000ff">bool</span><span style="COLOR: #000000">&#160;IsReusable 
<br/><img id="Codehighlighter1_641_669_Open_Image" onclick="this.style.display=&#39;none&#39;; Codehighlighter1_641_669_Open_Text.style.display=&#39;none&#39;; Codehighlighter1_641_669_Closed_Image.style.display=&#39;inline&#39;; Codehighlighter1_641_669_Closed_Text.style.display=&#39;inline&#39;;" height="16" src="http://www.cnblogs.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" width="11" align="top" /><img id="Codehighlighter1_641_669_Closed_Image" onclick="this.style.display=&#39;none&#39;; Codehighlighter1_641_669_Closed_Text.style.display=&#39;none&#39;; Codehighlighter1_641_669_Open_Image.style.display=&#39;inline&#39;; Codehighlighter1_641_669_Open_Text.style.display=&#39;inline&#39;;" height="16" src="http://www.cnblogs.com/images/OutliningIndicators/ContractedSubBlock.gif" width="11" align="top" style="DISPLAY: none" />&#160;&#160;</span><span id="Codehighlighter1_641_669_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img height="20" src="http://www.cnblogs.com/images/dot.gif" width="15" /></span><span id="Codehighlighter1_641_669_Open_Text"><span style="COLOR: #000000">{ 
<br/><img id="Codehighlighter1_650_665_Open_Image" onclick="this.style.display=&#39;none&#39;; Codehighlighter1_650_665_Open_Text.style.display=&#39;none&#39;; Codehighlighter1_650_665_Closed_Image.style.display=&#39;inline&#39;; Codehighlighter1_650_665_Closed_Text.style.display=&#39;inline&#39;;" height="16" src="http://www.cnblogs.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" width="11" align="top" /><img id="Codehighlighter1_650_665_Closed_Image" onclick="this.style.display=&#39;none&#39;; Codehighlighter1_650_665_Closed_Text.style.display=&#39;none&#39;; Codehighlighter1_650_665_Open_Image.style.display=&#39;inline&#39;; Codehighlighter1_650_665_Open_Text.style.display=&#39;inline&#39;;" height="16" src="http://www.cnblogs.com/images/OutliningIndicators/ContractedSubBlock.gif" width="11" align="top" style="DISPLAY: none" />&#160;&#160;&#160;&#160;</span><span style="COLOR: #0000ff">get</span><span id="Codehighlighter1_650_665_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img height="20" src="http://www.cnblogs.com/images/dot.gif" width="15" /></span><span id="Codehighlighter1_650_665_Open_Text"><span style="COLOR: #000000">{&#160;</span><span style="COLOR: #0000ff">return</span><span style="COLOR: #000000">&#160;</span><span style="COLOR: #0000ff">true</span><span style="COLOR: #000000">;&#160;}</span></span><span style="COLOR: #000000"> 
<br/><img height="16" src="http://www.cnblogs.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" width="11" align="top" />&#160;&#160;}</span></span><span style="COLOR: #000000"> 
<br/><img height="16" src="http://www.cnblogs.com/images/OutliningIndicators/ExpandedBlockEnd.gif" width="11" align="top" />}</span></span> 
       </div>
   </div></span>
</p>
<p></p>
<p></p>
<p>下面的Web.Config配置区域配置指出对于任何*.cs,*.resx,*.config文件的请求使用ForbiddenLogHandler进行处理。 
<br/><strong>&lt;httpHandlers&gt; 
<br/>&lt;add verb=&quot;*&quot; path=&quot;*.cs&quot; type=&quot;WebHandlers.ForbiddenLogHandler,WebHandlers&quot;/&gt; 
<br/>&#160;&#160; &lt;add verb=&quot;*&quot; path=&quot;*.resx&quot; type=&quot;WebHandlers.ForbiddenLogHandler,WebHandlers&quot;/&gt; 
<br/>&#160;&#160; &lt;add verb=&quot;*&quot; path=&quot;*.config&quot; type=&quot;WebHandlers.ForbiddenLogHandler,WebHandlers&quot;/&gt; 
<br/>&lt;/httpHandlers&gt;</strong> 
</p>
<p>
<br/>未完待续 
</p><img src ="http://www.cnblogs.com/bluefee/aggbug/127032.html?type=1" width = "1" height = "1" /><br><br><a href="http://news.cnblogs.com/n/41923/" target="_blank">[新闻]福布斯：Facebook网站十大最火爆游戏</a>]]></description></item><item><title>Microsoft Press新书介绍</title><link>http://www.cnblogs.com/bluefee/archive/2005/03/27/126893.html</link><dc:creator>Bluefee.Net</dc:creator><author>Bluefee.Net</author><pubDate>Sun, 27 Mar 2005 15:51:00 GMT</pubDate><guid>http://www.cnblogs.com/bluefee/archive/2005/03/27/126893.html</guid><wfw:comment>http://www.cnblogs.com/bluefee/comments/126893.html</wfw:comment><comments>http://www.cnblogs.com/bluefee/archive/2005/03/27/126893.html#Feedback</comments><slash:comments>7</slash:comments><wfw:commentRss>http://www.cnblogs.com/bluefee/comments/commentRss/126893.html</wfw:commentRss><trackback:ping>http://www.cnblogs.com/bluefee/services/trackbacks/126893.html</trackback:ping><description><![CDATA[<p><strong><font face="Verdana" color="#003366"><span style="COLOR: #333399"><strong><font face="Verdana" color="#003366" style="COLOR: #ff9900">今天看了看MSPress的主页，看到一些出版不久的新书和即将要出版的新书，推荐给大家 
<br/>当然现在国内估计还买不到，不过希望尽快引进哦</font></strong></span></font></strong> 
</p>
<p><strong><font face="Verdana" color="#003366">
<br/>书名的翻译纯属个人意见，水平有限，各位看家包涵，:) 
<br/>
<br/>Programming &quot;Indigo&quot;: The Unified Framework for Building Service-Oriented Applications on the Microsoft&#174; Windows&#174; Platform Beta Edition</font></strong> 
<br/>[个人译：Indigo程序设计：基于微软Windows平台构建面向服务应用程序统一框架] 
<br/>
<br/><img height="130" src="http://www.cnblogs.com/images/cnblogs_com/bluefee/Indigo.gif" width="130" /> 
<br/>出版日期：2005/06/15 
<br/>作者：<font face="Verdana" size="1" style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana">David Pallmann 
<br/>原文参考： 
<br/>
   <div class="ToggleBorder" style="WIDTH: 434px; POSITION: absolute; HEIGHT: 18px"><span style="BACKGROUND-COLOR: blue"><a href="http://www.microsoft.com/MSPress/books/7703.asp"></a></span><a href="http://www.microsoft.com/MSPress/books/7703.asp">http://www.microsoft.com/MSPress/books/7703.asp</a> 
   </div></font>
</p>
<p></p>
<p></p>
<p></p>
<p></p>
<p></p>
<p></p>
<p><font face="Verdana" size="1" style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana">
<br/>
<br/><strong><font color="#003366">Introducing Microsoft&#174; Visual Studio&#174; 2005 Team System Beta Edition</font></strong>&#160; 
<br/>[个人译：微软VSTS Beta版指南] 
<br/>
<br/><img height="130" src="http://www.cnblogs.com/images/cnblogs_com/bluefee/VSTS.gif" width="130" /> 
<br/>出版日期：2005/05/25 
<br/>作者：<font size="1"><span style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana"><font size="1" style="FONT-SIZE: 10pt">Richard Hundhausen</font> 
<br/></span></font>原文参考： 
<br/>&#160; 
   <div class="ToggleBorder" style="WIDTH: 434px; POSITION: absolute; HEIGHT: 18px"><a href="http://www.microsoft.com/MSPress/books/8378.asp">http://www.microsoft.com/MSPress/books/8378.asp</a> 
   </div>
<br/>
<br/><strong><font color="#003366">Practical Guidelines and Best Practices for Microsoft&#174; Visual Basic&#174; and Visual C#&#174; Developers</font></strong> 
<br/>[个人译：VB和C#开发者最佳实践指南] 
<br/>
<br/><img height="130" src="http://www.cnblogs.com/images/cnblogs_com/bluefee/VBCS.gif" width="130" /> 
<br/>
<br/>出版日期：2005/02/23 
<br/>作者：<font size="1"><span style="FONT-SIZE: 12pt; FONT-FAMILY: Verdana"><font size="1" style="FONT-SIZE: 10pt">Francesco Balena and Giuseppe Dimauro</font> 
<br/></span></font>原文参考： 
<br/>
   <div class="ToggleBorder" style="WIDTH: 436px; POSITION: absolute; HEIGHT: 18px"><a href="http://www.microsoft.com/MSPress/books/8198.asp">http://www.microsoft.com/MSPress/books/8198.asp</a> 
   </div>
<br/>
<br/><font color="#003366"><strong>Web Services Architecture and Its Specifications: Essentials for Understanding WS-* 
<br/>[个人译：Web Services 架构及规范：深度揭秘] 
<br/>
<br/><img height="130" src="http://www.cnblogs.com/images/cnblogs_com/bluefee/WS.gif" width="130" /> 
<br/></strong><span style="COLOR: #000000"><span style="COLOR: #000000"><span style="COLOR: #000000">出版日期：<font color="#003366" style="COLOR: #000000">2005/02/09</font> 
<br/></span>作者：<font color="#000000">Luis Felipe Cabrera, Chris Kurt</font> 
<br/>原文参考：</span></span> 
<br/>
   <div class="ToggleBorder" style="WIDTH: 432px; POSITION: absolute; HEIGHT: 18px"><a href="http://www.microsoft.com/MSPress/books/7913.asp">http://www.microsoft.com/MSPress/books/7913.asp</a> 
   </div>
   <p>
<br/>
   </p>
   <p><strong>Customizing the Microsoft&#174; .NET Framework Common Language Runtime</strong> 
<br/>[个人译：CLR高级技术：定制.Net框架通用语言运行时] 
<br/>
<br/><img height="130" src="http://www.cnblogs.com/images/cnblogs_com/bluefee/CLR.gif" width="130" /> 
<br/><span style="FONT-SIZE: 10pt"><span style="COLOR: #000000"><span style="FONT-SIZE: 10pt">出版日期：2005/01/26 
<br/>作者：<font size="1"><span style="FONT-SIZE: 10pt"><font size="1" style="FONT-SIZE: 10pt">Steven Pratschner</font></span> 
<br/><span style="FONT-SIZE: 10pt">原文参考：</span></font></span></span><font size="1"><span style="FONT-SIZE: 10pt"> 
<br/>
       <div class="ToggleBorder" style="WIDTH: 430px; POSITION: absolute; HEIGHT: 18px"><a href="http://www.microsoft.com/MSPress/books/6895.asp">http://www.microsoft.com/MSPress/books/6895.asp</a> 
       </div></span></font></span>
   </p></font></font>
</p> [个人译：VB和C#开发者最佳实践指南]  出版日期：2005/02/23 作者：原文参考： <img src ="http://www.cnblogs.com/bluefee/aggbug/126893.html?type=1" width = "1" height = "1" /><br><br><a href="http://news.cnblogs.com/n/41922/" target="_blank">[新闻]谷歌允许用户评论搜索结果调整顺序</a>]]></description></item><item><title>Inside IIS And ASP.NET [ 2 ]</title><link>http://www.cnblogs.com/bluefee/archive/2005/03/27/126730.html</link><dc:creator>Bluefee.Net</dc:creator><author>Bluefee.Net</author><pubDate>Sun, 27 Mar 2005 11:22:00 GMT</pubDate><guid>http://www.cnblogs.com/bluefee/archive/2005/03/27/126730.html</guid><wfw:comment>http://www.cnblogs.com/bluefee/comments/126730.html</wfw:comment><comments>http://www.cnblogs.com/bluefee/archive/2005/03/27/126730.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnblogs.com/bluefee/comments/commentRss/126730.html</wfw:commentRss><trackback:ping>http://www.cnblogs.com/bluefee/services/trackbacks/126730.html</trackback:ping><description><![CDATA[<p>&lt;httpHandlers&gt;区域指出将由哪些HTTP处理工厂（HTTP Handler Factory）或处理器（Handler）处理请求操作。一般来说从IIS到ASP.NET的高级别工作流有以下几点： 
<br/>1、IIS接受并请求资源 
<br/>2、资源被映射到ASP.NET ISAPI扩展（i.e., *.aspx, *.asmx），接着请求被传递给非托管的ASP.NET DLL并使用HttpRuntime对象进行通信。 
<br/>3、HttpRuntime对象处理并在必要时创建HttpApplication对象同时检查配置设置，接着传递控件到适当的请求处理器（Handler）。 
<br/>4、处理器创建一个请求过程直到最后发送响应。 
<br/>下面这个图表阐明了这个工作流： 
<br/><img height="280" src="http://www.cnblogs.com/images/cnblogs_com/bluefee/image03.jpg" width="479" /> 
<br/>&lt;httpHandlers&gt;配置允许被修改作为全局级别即整个ASP.NET共享同一配置文件（Machine.Config）或者重载应用程序级别即当前应用程序共享同一配置文件（Web.Config）。从另外的角度来说就是你能够指定一个特殊的处理工厂或处理器来处理一些特殊的资源请求。举例来说，对于一个拒绝的请求对象（*.rem），你可以编辑Machine.Config或Web.Config文件如下： 
<br/>
<br/><strong>&lt;add verb=&quot;*&quot; path=&quot;*.rem&quot; type=&quot;System.Web.HttpForbiddenHandler&quot;/&gt; 
<br/>
<br/></strong>这段配置语句的含义是使用HttpForbiddenHandler替换对于*.rem文件请求的默认处理行为（HttpRemotingHandlerFactory）。如果你指定该重载部分位于Machine.Config文件中，那么该效果将影响Web服务器的所有应用程序。 
<br/><img height="281" src="http://www.cnblogs.com/images/cnblogs_com/bluefee/image04.jpg" width="478" /> 
<br/><span style="COLOR: red">H</span><span style="COLOR: red">TTP处理器和处理工厂 
<br/><span style="COLOR: #000000">ASP.NET运行时是依赖HTTP处理器和处理工厂来处理请求的。配置文件设置使得HTTP处理器和处理工厂类关联到指定的资源。我们来仔细看看下面这些配置语句： 
<br/>下面这句配置语句指出使用System.Web.UI.PageHandlerFactory类处理所有对*.aspx文件的请求动作。 
<br/>
<br/><strong>&lt;add verb=&quot;*&quot; path=&quot;*.aspx&quot; type=&quot;System.Web.UI.PageHandlerFactory&quot;/&gt; 
<br/>
<br/></strong>下面这句指出使用System.Web.HttpForbiddenHandler类处理所有对*.config资源的请求动作。 
<br/>
<br/><strong>&lt;add verb=&quot;*&quot; path=&quot;*.config&quot; type=&quot;System.Web.HttpForbiddenHandler&quot;/&gt; 
<br/>
<br/></strong>以上这些类是基本类库提供的，但是我们也可以构建自己的处理器和处理工厂类，只需实现<span style="COLOR: #ff0000">IHttpHandlerFactory<span style="COLOR: #000000">和</span>IHttpHandler<span style="COLOR: #000000">接口</span><span style="COLOR: #000000">中的一个。在讨论如何实现自定义的处理器和处理工厂类之前，我们先回顾一下它们的特性。处理器和处理工厂指定动态有序地返回正确的处理器对象来管理请求资源。如果一个HTTP处理器被指定，这意味着它在运行时直接被实例化，并且不管最后结果直接为这些资源调用一个处理器。 
<br/>当运行时传递控件到处理器后，处理器的工作就是处理请求并且恰当的实例化服务端控件接着发出一个HTTP响应。举例来说PageHandlerFactory对象对于*.aspx资源的请求返回一个System.Web.Page对象并且System.Web.HttpForbiddenHandler对不支持的请求将会抛出一个HttpException异常。</span></span></span></span> 
</p>
<p><span style="COLOR: red"><span style="COLOR: #000000"><span style="COLOR: #ff0000"><span style="COLOR: #000000"></span></span></span></span>
</p>
<p><span style="COLOR: red"><span style="COLOR: #000000"><span style="COLOR: #ff0000"><span style="COLOR: #000000">未完待续。。。</span></span></span></span> 
</p><img src ="http://www.cnblogs.com/bluefee/aggbug/126730.html?type=1" width = "1" height = "1" /><br><br><a href="http://news.cnblogs.com/n/41922/" target="_blank">[新闻]谷歌允许用户评论搜索结果调整顺序</a>]]></description></item><item><title>Inside IIS And ASP.NET [ 1 ]</title><link>http://www.cnblogs.com/bluefee/archive/2005/03/26/126259.html</link><dc:creator>Bluefee.Net</dc:creator><author>Bluefee.Net</author><pubDate>Sat, 26 Mar 2005 06:42:00 GMT</pubDate><guid>http://www.cnblogs.com/bluefee/archive/2005/03/26/126259.html</guid><wfw:comment>http://www.cnblogs.com/bluefee/comments/126259.html</wfw:comment><comments>http://www.cnblogs.com/bluefee/archive/2005/03/26/126259.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnblogs.com/bluefee/comments/commentRss/126259.html</wfw:commentRss><trackback:ping>http://www.cnblogs.com/bluefee/services/trackbacks/126259.html</trackback:ping><description><![CDATA[<p>[翻译] 
<br/>文章来源：<a href="http://www.theserverside.net/articles/showarticle.tss?id=IIS_ASP">http://www.theserverside.net/articles/showarticle.tss?id=IIS_ASP</a> 
<br/>
<br/>&#160;&#160;&#160;&#160;&#160;IIS与.Net Framework是通过非托管的ISAPI扩展（aspnet_isapi.dll和aspnet_filter.dll)进行通信的。aspnet_isapi_dll扩展用于处理路由请求而aspnet_filter.dll主要处理ASP.NET的无状态会话，这些非托管的组件连同Windows服务状态（aspnet_state.exe)和ASP.NET工作进程(aspnet_wp.exe)组成了ASP.NET处理模型的核心。 
<br/>&#160;&#160;&#160; 当.Net Framework安装到机器之后（前提安装成功IIS),IIS配置明确的扩展处理请求到aspnet_isapi.dll,有意思的是筛选器也同样被配置到IIS的内部。 
<br/><img height="249" src="http://www.cnblogs.com/images/cnblogs_com/bluefee/image01.jpg" width="574" /> 
<br/>对于ASP.NET资源的请求被传递给IIS和ASP.NET扩展配置，该配置是非托管代码和托管代码之前的桥梁。当控件被传递到你的应用程序之前，ASP.NET应用程序对象必须被实例化（在运行时刻）并且考虑决定如何配置设定对请求的处理。Machine.config和Web.Config文件（内部配置元素集合）可以处理全部的请求。 
<br/><img height="280" src="http://www.cnblogs.com/images/cnblogs_com/bluefee/image02.jpg" width="574" /> 
<br/>在本文中我们将主要关注&lt;httpHandlers&gt;配置区域，该区域意味着配置.Net处理请求的类型。在默认的Machine.Config文件中可以找到以下代码： 
<br/>
</p><span style="FONT-SIZE: 8pt"><strong>&lt;httpHandlers&gt; 
<br/>&#160;&#160; &lt;add verb=&quot;*&quot; path=&quot;trace.axd&quot; type=&quot;System.Web.Handlers.TraceHandler&quot;/&gt; 
<br/>&#160;&#160; &lt;add verb=&quot;*&quot; path=&quot;*.aspx&quot; type=&quot;System.Web.UI.PageHandlerFactory&quot;/&gt; 
<br/>&#160;&#160; &lt;add verb=&quot;*&quot; path=&quot;*.ashx&quot; type=&quot;System.Web.UI.SimpleHandlerFactory&quot;/&gt; 
<br/>&#160;&#160; &lt;add verb=&quot;*&quot; path=&quot;*.asmx&quot; type=&quot;System.Web.Services.Protocols.WebServiceHandlerFactory, 
<br/>System.Web.Services, Version=1.0.3300.0, Culture=neutral, 
<br/>PublicKeyToken=b03f5f7f11d50a3a&quot; validate=&quot;false&quot;/&gt; 
<br/>&#160;&#160; &lt;add verb=&quot;*&quot; path=&quot;*.rem&quot; 
<br/>type=&quot;System.Runtime.Remoting.Channels.Http.HttpRemotingHandlerFactory, 
<br/>System.Runtime.Remoting, Version=1.0.3300.0, Culture=neutral, 
<br/>PublicKeyToken=b77a5c561934e089&quot; validate=&quot;false&quot;/&gt; 
<br/>&#160;&#160; &lt;add verb=&quot;*&quot; path=&quot;*.soap&quot; 
<br/>type=&quot;System.Runtime.Remoting.Channels.Http.HttpRemotingHandlerFactory, 
<br/>System.Runtime.Remoting, Version=1.0.3300.0, Culture=neutral, 
<br/>PublicKeyToken=b77a5c561934e089&quot; validate=&quot;false&quot;/&gt; 
<br/>&#160;&#160; &lt;add verb=&quot;*&quot; path=&quot;*.asax&quot; type=&quot;System.Web.HttpForbiddenHandler&quot;/&gt; 
<br/>&#160;&#160; &lt;add verb=&quot;*&quot; path=&quot;*.ascx&quot; type=&quot;System.Web.HttpForbiddenHandler&quot;/&gt; 
<br/>&#160;&#160; &lt;add verb=&quot;*&quot; path=&quot;*.config&quot; type=&quot;System.Web.HttpForbiddenHandler&quot;/&gt; 
<br/>&#160;&#160; &lt;add verb=&quot;*&quot; path=&quot;*.cs&quot; type=&quot;System.Web.HttpForbiddenHandler&quot;/&gt; 
<br/>&#160;&#160; &lt;add verb=&quot;*&quot; path=&quot;*.csproj&quot; type=&quot;System.Web.HttpForbiddenHandler&quot;/&gt; 
<br/>&#160;&#160; &lt;add verb=&quot;*&quot; path=&quot;*.vb&quot; type=&quot;System.Web.HttpForbiddenHandler&quot;/&gt; 
<br/>&#160;&#160; &lt;add verb=&quot;*&quot; path=&quot;*.vbproj&quot; type=&quot;System.Web.HttpForbiddenHandler&quot;/&gt; 
<br/>&#160;&#160; &lt;add verb=&quot;*&quot; path=&quot;*.webinfo&quot; type=&quot;System.Web.HttpForbiddenHandler&quot;/&gt; 
<br/>&#160;&#160; &lt;add verb=&quot;*&quot; path=&quot;*.asp&quot; type=&quot;System.Web.HttpForbiddenHandler&quot;/&gt; 
<br/>&#160;&#160; &lt;add verb=&quot;*&quot; path=&quot;*.licx&quot; type=&quot;System.Web.HttpForbiddenHandler&quot;/&gt; 
<br/>&#160;&#160; &lt;add verb=&quot;*&quot; path=&quot;*.resx&quot; type=&quot;System.Web.HttpForbiddenHandler&quot;/&gt; 
<br/>&#160;&#160; &lt;add verb=&quot;*&quot; path=&quot;*.resources&quot; type=&quot;System.Web.HttpForbiddenHandler&quot;/&gt; 
<br/>&#160;&#160; &lt;add verb=&quot;GET,HEAD&quot; path=&quot;*&quot; type=&quot;System.Web.StaticFileHandler&quot;/&gt; 
<br/>&#160;&#160; &lt;add verb=&quot;*&quot; path=&quot;*&quot; type=&quot;System.Web.HttpMethodNotAllowedHandler&quot;/&gt; 
<br/>&lt;/httpHandlers&gt; </strong></span>
<br/>
<br/>未完代续。 
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/><img src ="http://www.cnblogs.com/bluefee/aggbug/126259.html?type=1" width = "1" height = "1" /><br><br><a href="http://news.cnblogs.com/n/41921/" target="_blank">[新闻]Internet 另一超级漏洞被公布</a>]]></description></item></channel></rss>