<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom"><title type="text">博客园_鹤冲天_分类_扩展方法</title><id>http://feed.cnblogs.com/blog/u/59407/category/260324/rss</id><updated>2012-06-03T11:39:45Z</updated><generator>feed.cnblogs.com</generator><link rel="alternate" type="text/html" href="http://www.cnblogs.com/ldp615/category/260324.html"/><link rel="self" type="application/atom+xml" href="http://feed.cnblogs.com/blog/u/59407/category/260324/rss"/><entry><id>http://www.cnblogs.com/ldp615/archive/2012/01/15/orderby-extensions.html</id><title type="text">c# 扩展方法 奇思妙用 高级篇 九：OrderBy(string propertyName, bool desc)</title><summary type="text">如题，本文实现 OrderBy(string propertyName, bool desc) 扩展方法，以弥补 Linq 原生排序方法的不足</summary><published>2012-01-15T10:41:00Z</published><updated>2012-01-15T10:41:00Z</updated><author><name>鹤冲天</name><uri>http://www.cnblogs.com/ldp615/</uri></author><link rel="alternate" href="http://www.cnblogs.com/ldp615/archive/2012/01/15/orderby-extensions.html"/><link rel="alternate" type="text/html" href="http://www.cnblogs.com/ldp615/archive/2012/01/15/orderby-extensions.html"/><content type="html"/></entry><entry><id>http://www.cnblogs.com/ldp615/archive/2011/12/10/is-empty-and-is-not-empty-extension-methods.html</id><title type="text">c# 扩展方法奇思妙用基础篇十：IsEmpty、IsNotEmpty 扩展</title><summary type="text">IsEmpty、IsNotEmpty 扩展方法，用来确定序列是否包含元素。</summary><published>2011-12-10T14:45:00Z</published><updated>2011-12-10T14:45:00Z</updated><author><name>鹤冲天</name><uri>http://www.cnblogs.com/ldp615/</uri></author><link rel="alternate" href="http://www.cnblogs.com/ldp615/archive/2011/12/10/is-empty-and-is-not-empty-extension-methods.html"/><link rel="alternate" type="text/html" href="http://www.cnblogs.com/ldp615/archive/2011/12/10/is-empty-and-is-not-empty-extension-methods.html"/><content type="html"/></entry><entry><id>http://www.cnblogs.com/ldp615/archive/2011/10/07/can-you-find-the-error-in-foreach-extension-method.html</id><title type="text">你能指出这个 ForEach 扩展方法中的错误吗？</title><summary type="text">Linq 中没有原生的 ForEach 扩展方法，我们可以很轻松的扩展一个......但这个有返回值的实现中有错误的，你能指出吗？</summary><published>2011-10-07T08:06:00Z</published><updated>2011-10-07T08:06:00Z</updated><author><name>鹤冲天</name><uri>http://www.cnblogs.com/ldp615/</uri></author><link rel="alternate" href="http://www.cnblogs.com/ldp615/archive/2011/10/07/can-you-find-the-error-in-foreach-extension-method.html"/><link rel="alternate" type="text/html" href="http://www.cnblogs.com/ldp615/archive/2011/10/07/can-you-find-the-error-in-foreach-extension-method.html"/><content type="html"/></entry><entry><id>http://www.cnblogs.com/ldp615/archive/2011/09/15/expression-extension-methods.html</id><title type="text">c# 扩展方法奇思妙用基础篇九：Expression 扩展</title><summary type="text">使用 Expression 类创建 Expression Trees 的代码往往比较繁琐，可以借助扩展方法予以简化。</summary><published>2011-09-15T09:18:00Z</published><updated>2011-09-15T09:18:00Z</updated><author><name>鹤冲天</name><uri>http://www.cnblogs.com/ldp615/</uri></author><link rel="alternate" href="http://www.cnblogs.com/ldp615/archive/2011/09/15/expression-extension-methods.html"/><link rel="alternate" type="text/html" href="http://www.cnblogs.com/ldp615/archive/2011/09/15/expression-extension-methods.html"/><content type="html"/></entry><entry><id>http://www.cnblogs.com/ldp615/archive/2011/08/08/or-not-extension-method.html</id><title type="text">c# 扩展方法奇思妙用滥用篇一：改进 2011 年最佳代码</title><summary type="text">使用 OrNot 扩展方法性改进 2011 年最佳代码：if (whatEver(you.Believe)(it).OrNot()) I.Believe(it);</summary><published>2011-08-08T10:39:00Z</published><updated>2011-08-08T10:39:00Z</updated><author><name>鹤冲天</name><uri>http://www.cnblogs.com/ldp615/</uri></author><link rel="alternate" href="http://www.cnblogs.com/ldp615/archive/2011/08/08/or-not-extension-method.html"/><link rel="alternate" type="text/html" href="http://www.cnblogs.com/ldp615/archive/2011/08/08/or-not-extension-method.html"/><content type="html"/></entry><entry><id>http://www.cnblogs.com/ldp615/archive/2011/08/01/distinct-entension.html</id><title type="text">c# 扩展方法奇思妙用基础篇八：Distinct 扩展</title><summary type="text">刚看了篇文章 《Linq的Distinct太不给力了》，文中解决办法，略显复杂。使用本文的扩展方法可写成如下优雅的方式：var p1 = products.Distinct(p =&gt; p.ID)</summary><published>2011-08-01T12:57:00Z</published><updated>2011-08-01T12:57:00Z</updated><author><name>鹤冲天</name><uri>http://www.cnblogs.com/ldp615/</uri></author><link rel="alternate" href="http://www.cnblogs.com/ldp615/archive/2011/08/01/distinct-entension.html"/><link rel="alternate" type="text/html" href="http://www.cnblogs.com/ldp615/archive/2011/08/01/distinct-entension.html"/><content type="html"/></entry><entry><id>http://www.cnblogs.com/ldp615/archive/2011/02/18/IsBetween-ExtensionMethod.html</id><title type="text">c# 扩展方法奇思妙用基础篇七：IsBetween 通用扩展</title><summary type="text">写个扩展容易，但写一个通用的扩展可不简单，试看本文借如何优雅的完成通用的 IsBetween 扩展...</summary><published>2011-02-18T13:09:00Z</published><updated>2011-02-18T13:09:00Z</updated><author><name>鹤冲天</name><uri>http://www.cnblogs.com/ldp615/</uri></author><link rel="alternate" href="http://www.cnblogs.com/ldp615/archive/2011/02/18/IsBetween-ExtensionMethod.html"/><link rel="alternate" type="text/html" href="http://www.cnblogs.com/ldp615/archive/2011/02/18/IsBetween-ExtensionMethod.html"/><content type="html"/></entry><entry><id>http://www.cnblogs.com/ldp615/archive/2011/02/17/WhereIf-ExtensionMethod.html</id><title type="text">c# 扩展方法奇思妙用基础篇 六：WhereIf 扩展</title><summary type="text">创建并使用 WhereIf 扩展方法简化代码...</summary><published>2011-02-17T11:24:00Z</published><updated>2011-02-17T11:24:00Z</updated><author><name>鹤冲天</name><uri>http://www.cnblogs.com/ldp615/</uri></author><link rel="alternate" href="http://www.cnblogs.com/ldp615/archive/2011/02/17/WhereIf-ExtensionMethod.html"/><link rel="alternate" type="text/html" href="http://www.cnblogs.com/ldp615/archive/2011/02/17/WhereIf-ExtensionMethod.html"/><content type="html"/></entry><entry><id>http://www.cnblogs.com/ldp615/archive/2011/01/28/dictionary-extensions.html</id><title type="text">c# 扩展方法奇思妙用基础篇五：Dictionary&amp;lt;TKey, TValue&amp;gt; 扩展</title><summary type="text">为 Dictionary&lt;TKey, TValue&gt; 类创建几个扩展方法，让使用更加简洁高效...</summary><published>2011-01-28T10:41:00Z</published><updated>2011-01-28T10:41:00Z</updated><author><name>鹤冲天</name><uri>http://www.cnblogs.com/ldp615/</uri></author><link rel="alternate" href="http://www.cnblogs.com/ldp615/archive/2011/01/28/dictionary-extensions.html"/><link rel="alternate" type="text/html" href="http://www.cnblogs.com/ldp615/archive/2011/01/28/dictionary-extensions.html"/><content type="html"/></entry><entry><id>http://www.cnblogs.com/ldp615/archive/2011/01/27/random-extensions.html</id><title type="text">c# 扩展方法奇思妙用基础篇四：Random 扩展</title><summary type="text">在 .Net 中，我们一般使用 Random 类来生成随机数，它仅提供了几个基本方法供我们使用。如果想生成一些特殊的随机数，如枚举、日期等，则要再进行几步处理。本文将会扩展 Random 类，让随机更方便...</summary><published>2011-01-27T12:45:00Z</published><updated>2011-01-27T12:45:00Z</updated><author><name>鹤冲天</name><uri>http://www.cnblogs.com/ldp615/</uri></author><link rel="alternate" href="http://www.cnblogs.com/ldp615/archive/2011/01/27/random-extensions.html"/><link rel="alternate" type="text/html" href="http://www.cnblogs.com/ldp615/archive/2011/01/27/random-extensions.html"/><content type="html"/></entry><entry><id>http://www.cnblogs.com/ldp615/archive/2010/04/17/TextBoxFor.html</id><title type="text">c# 扩展方法奇思妙用 ASP.NET MVC 篇：巧用扩展方法优先级，美化所有页面 TextBoxFor 文本框</title><summary type="text">巧妙使用扩展方法的优先级，美化你网站(ASP.NET MVC)页面的TextBoxFor文本框；配合js脚本，还能限制用户录入。而且你甚至不需要修改任何一个前台页面...</summary><published>2010-04-17T13:12:00Z</published><updated>2010-04-17T13:12:00Z</updated><author><name>鹤冲天</name><uri>http://www.cnblogs.com/ldp615/</uri></author><link rel="alternate" href="http://www.cnblogs.com/ldp615/archive/2010/04/17/TextBoxFor.html"/><link rel="alternate" type="text/html" href="http://www.cnblogs.com/ldp615/archive/2010/04/17/TextBoxFor.html"/><content type="text">巧妙使用扩展方法的优先级，美化你网站(ASP.NET MVC)页面的TextBoxFor文本框；配合js脚本，还能限制用户录入。而且你甚至不需要修改任何一个前台页面...</content></entry><entry><id>http://www.cnblogs.com/ldp615/archive/2009/12/11/TypeExtension.html</id><title type="text">c# 扩展方法奇思妙用高级篇八：Type类扩展</title><summary type="text">Type 类提供了大量的属性和方法，但在一些基础性开发工作中，Type类功能还有些欠缺，尤其上在处理泛型类型时，如可空类型和泛型集合类型。下面的类就针对这些地方进行扩展...</summary><published>2009-12-11T11:43:00Z</published><updated>2009-12-11T11:43:00Z</updated><author><name>鹤冲天</name><uri>http://www.cnblogs.com/ldp615/</uri></author><link rel="alternate" href="http://www.cnblogs.com/ldp615/archive/2009/12/11/TypeExtension.html"/><link rel="alternate" type="text/html" href="http://www.cnblogs.com/ldp615/archive/2009/12/11/TypeExtension.html"/><content type="text">Type 类提供了大量的属性和方法，但在一些基础性开发工作中，Type类功能还有些欠缺，尤其上在处理泛型类型时，如可空类型和泛型集合类型。下面的类就针对这些地方进行扩展...</content></entry><entry><id>http://www.cnblogs.com/ldp615/archive/2009/11/09/1599312.html</id><title type="text">c#扩展方法奇思妙用高级篇七：“树”通用遍历器</title><summary type="text">“树”的遍历是一个通用算法，本文给出“树”遍历的通用扩展方法...</summary><published>2009-11-09T14:06:00Z</published><updated>2009-11-09T14:06:00Z</updated><author><name>鹤冲天</name><uri>http://www.cnblogs.com/ldp615/</uri></author><link rel="alternate" href="http://www.cnblogs.com/ldp615/archive/2009/11/09/1599312.html"/><link rel="alternate" type="text/html" href="http://www.cnblogs.com/ldp615/archive/2009/11/09/1599312.html"/><content type="text">“树”的遍历是一个通用算法，本文给出“树”遍历的通用扩展方法...</content></entry><entry><id>http://www.cnblogs.com/ldp615/archive/2009/11/08/1598596.html</id><title type="text">c# 扩展方法奇思妙用高级篇六：WinForm 控件选择器</title><summary type="text">在Web开发中，jQuery提供了功能异常强大的$选择器来帮助我们获取页面上的对象。但在WinForm中，.Net似乎没有这样一个使用起来比较方便的选择器。好在我们有扩展方法，可以很方便的打造一个。</summary><published>2009-11-08T13:17:00Z</published><updated>2009-11-08T13:17:00Z</updated><author><name>鹤冲天</name><uri>http://www.cnblogs.com/ldp615/</uri></author><link rel="alternate" href="http://www.cnblogs.com/ldp615/archive/2009/11/08/1598596.html"/><link rel="alternate" type="text/html" href="http://www.cnblogs.com/ldp615/archive/2009/11/08/1598596.html"/><content type="text">在Web开发中，jQuery提供了功能异常强大的$选择器来帮助我们获取页面上的对象。但在WinForm中，.Net似乎没有这样一个使用起来比较方便的选择器。好在我们有扩展方法，可以很方便的打造一个。</content></entry><entry><id>http://www.cnblogs.com/ldp615/archive/2009/09/02/1559020.html</id><title type="text">c# 扩展方法奇思妙用高级篇五：ToString(string format) 扩展</title><summary type="text">本文给出了ToString(string format)的扩展实现，一劳永逸...</summary><published>2009-09-02T13:09:00Z</published><updated>2009-09-02T13:09:00Z</updated><author><name>鹤冲天</name><uri>http://www.cnblogs.com/ldp615/</uri></author><link rel="alternate" href="http://www.cnblogs.com/ldp615/archive/2009/09/02/1559020.html"/><link rel="alternate" type="text/html" href="http://www.cnblogs.com/ldp615/archive/2009/09/02/1559020.html"/><content type="text">本文给出了ToString(string format)的扩展实现，一劳永逸...</content></entry><entry><id>http://www.cnblogs.com/ldp615/archive/2009/08/29/1555309.html</id><title type="text">c# 扩展方法奇思妙用高级篇四：对扩展进行分组管理</title><summary type="text">从系列文章开篇到现在，已经实现的很多扩展了，但过多的扩展会给我们带来很多麻烦...本文给出了三种解决方法...</summary><published>2009-08-29T15:49:00Z</published><updated>2009-08-29T15:49:00Z</updated><author><name>鹤冲天</name><uri>http://www.cnblogs.com/ldp615/</uri></author><link rel="alternate" href="http://www.cnblogs.com/ldp615/archive/2009/08/29/1555309.html"/><link rel="alternate" type="text/html" href="http://www.cnblogs.com/ldp615/archive/2009/08/29/1555309.html"/><content type="text">从系列文章开篇到现在，已经实现的很多扩展了，但过多的扩展会给我们带来很多麻烦...本文给出了三种解决方法...</content></entry><entry><id>http://www.cnblogs.com/ldp615/archive/2009/08/26/1554524.html</id><title type="text">c# 扩展方法奇思妙用变态篇四：string 的翻身革命</title><summary type="text">string是各种编程语言中最基础的数据类型，长期以来受尽其它类的压迫...而现在string要“翻身闹革命”了，它几乎无所不能，可以为所欲为，令其它类心惊胆颤...</summary><published>2009-08-26T12:27:00Z</published><updated>2009-08-26T12:27:00Z</updated><author><name>鹤冲天</name><uri>http://www.cnblogs.com/ldp615/</uri></author><link rel="alternate" href="http://www.cnblogs.com/ldp615/archive/2009/08/26/1554524.html"/><link rel="alternate" type="text/html" href="http://www.cnblogs.com/ldp615/archive/2009/08/26/1554524.html"/><content type="text">string是各种编程语言中最基础的数据类型，长期以来受尽其它类的压迫...而现在string要“翻身闹革命”了，它几乎无所不能，可以为所欲为，令其它类心惊胆颤...</content></entry><entry><id>http://www.cnblogs.com/ldp615/archive/2009/08/22/1552133.html</id><title type="text">c# 扩展方法奇思妙用基础篇三：byte 常用扩展</title><summary type="text">byte 常用的八种扩展</summary><published>2009-08-22T13:11:00Z</published><updated>2009-08-22T13:11:00Z</updated><author><name>鹤冲天</name><uri>http://www.cnblogs.com/ldp615/</uri></author><link rel="alternate" href="http://www.cnblogs.com/ldp615/archive/2009/08/22/1552133.html"/><link rel="alternate" type="text/html" href="http://www.cnblogs.com/ldp615/archive/2009/08/22/1552133.html"/><content type="text">byte 常用的八种扩展</content></entry><entry><id>http://www.cnblogs.com/ldp615/archive/2009/08/18/1549159.html</id><title type="text">c#扩展方法奇思妙用变态篇三：switch/case组扩展</title><summary type="text">变态篇二中给出了对if/else、swith/case及while 的扩展，其中举了一个Swith扩展的应用...今天突然有了新想法，对Switch扩展进行了改进。所谓“语不惊人死不休”，且看这次的改进如何...</summary><published>2009-08-18T12:32:00Z</published><updated>2009-08-18T12:32:00Z</updated><author><name>鹤冲天</name><uri>http://www.cnblogs.com/ldp615/</uri></author><link rel="alternate" href="http://www.cnblogs.com/ldp615/archive/2009/08/18/1549159.html"/><link rel="alternate" type="text/html" href="http://www.cnblogs.com/ldp615/archive/2009/08/18/1549159.html"/><content type="text">变态篇二中给出了对if/else、swith/case及while 的扩展，其中举了一个Swith扩展的应用...今天突然有了新想法，对Switch扩展进行了改进。所谓“语不惊人死不休”，且看这次的改进如何...</content></entry><entry><id>http://www.cnblogs.com/ldp615/archive/2009/08/17/1548369.html</id><title type="text">c# 扩展方法奇思妙用高级篇三：Enumerable.Cast&amp;lt;T&amp;gt; 应用</title><summary type="text">Enumerable.Cast用于将IEnumerable转换为泛型版本IEnumerable。转换后可尽情享用Enumerable的其它方法...但MSDN中仅给出一个转换ArrayList的例子，很多人看了感觉用处不多，其实不然...</summary><published>2009-08-17T13:10:00Z</published><updated>2009-08-17T13:10:00Z</updated><author><name>鹤冲天</name><uri>http://www.cnblogs.com/ldp615/</uri></author><link rel="alternate" href="http://www.cnblogs.com/ldp615/archive/2009/08/17/1548369.html"/><link rel="alternate" type="text/html" href="http://www.cnblogs.com/ldp615/archive/2009/08/17/1548369.html"/><content type="text">Enumerable.Cast用于将IEnumerable转换为泛型版本IEnumerable。转换后可尽情享用Enumerable的其它方法...但MSDN中仅给出一个转换ArrayList的例子，很多人看了感觉用处不多，其实不然...</content></entry></feed>
