<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom"><title type="text">博客园_鹤冲天_分类_c#</title><id>http://feed.cnblogs.com/blog/u/59407/category/203884/rss</id><updated>2012-06-03T11:39:32Z</updated><generator>feed.cnblogs.com</generator><link rel="alternate" type="text/html" href="http://www.cnblogs.com/ldp615/category/203884.html"/><link rel="self" type="application/atom+xml" href="http://feed.cnblogs.com/blog/u/59407/category/203884/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/11/2284154.html</id><title type="text">Linq：切勿使用 Count() &amp;gt; 0 来判断集合非空</title><summary type="text">如题，使用 Linq 时切勿使用 Count() &gt; 0 来判断集合非空，这样做可能会带来严重的性能问题</summary><published>2011-12-11T12:51:00Z</published><updated>2011-12-11T12:51: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/11/2284154.html"/><link rel="alternate" type="text/html" href="http://www.cnblogs.com/ldp615/archive/2011/12/11/2284154.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/12/09/simple-create-a-complex-tree.html</id><title type="text">四行代码创建复杂（无限级）树</title><summary type="text">最近两三天一直在做树方面的基础工作，碰巧今天在博客园看到一篇关于动态创建树文章，粗略浏览下，感觉有不够强大。相比而言，感觉自己的方式更好些，只需要四行代码就可以创建一颗复杂的无限级树</summary><published>2011-12-09T12:38:00Z</published><updated>2011-12-09T12:38: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/09/simple-create-a-complex-tree.html"/><link rel="alternate" type="text/html" href="http://www.cnblogs.com/ldp615/archive/2011/12/09/simple-create-a-complex-tree.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/21/reuse-entity-framework-english-pluralization-service.html</id><title type="text">复用 Entity Framework 中英语单复数形式变换的类</title><summary type="text">数据库表名用复数、实体类名用单数，集合属性用单数…编程中经常会遇到英语单复变换的问题，你能准确处理吗？对我来说，十年前或许可以，but don't worry，我们有现成的类提供些类服务，来自 EntityFrameWork。</summary><published>2011-09-21T13:24:00Z</published><updated>2011-09-21T13: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/09/21/reuse-entity-framework-english-pluralization-service.html"/><link rel="alternate" type="text/html" href="http://www.cnblogs.com/ldp615/archive/2011/09/21/reuse-entity-framework-english-pluralization-service.html"/><content type="html"/></entry><entry><id>http://www.cnblogs.com/ldp615/archive/2011/09/18/asp-net-mvc-expression-trees-as-action-parameter-part2.html</id><title type="text">ASP.NET MVC：Expression Trees 作为参数简化查询 二</title><summary type="text">Expression Trees 可用作 Action 的参数来简化查询，前文中给出的 QueryConditionExpressionModelBinder 类，比较僵化，无法满足实际要求。本文将会从这个类为起点，基于 Convention 构建一个灵活的解决方案。</summary><published>2011-09-18T09:25:00Z</published><updated>2011-09-18T09:25: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/18/asp-net-mvc-expression-trees-as-action-parameter-part2.html"/><link rel="alternate" type="text/html" href="http://www.cnblogs.com/ldp615/archive/2011/09/18/asp-net-mvc-expression-trees-as-action-parameter-part2.html"/><content type="html"/></entry><entry><id>http://www.cnblogs.com/ldp615/archive/2011/09/16/asp-net-mvc-expression-trees-as-action-parameter.html</id><title type="text">ASP.NET MVC：Expression Trees 作为参数简化查询</title><summary type="text">MVC 引入了 ModelBinder，让我们可以在 Action 中以强类型参数的形式接收 Request 中的数据。在查询 Action 中，我们可以将 Expression Trees 用作参数，通过自定义的 ModelBinder 动态自动构建查询表达式树，进一步发挥 MVC 的威力，简化编码工作。</summary><published>2011-09-16T15:09:00Z</published><updated>2011-09-16T15: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/09/16/asp-net-mvc-expression-trees-as-action-parameter.html"/><link rel="alternate" type="text/html" href="http://www.cnblogs.com/ldp615/archive/2011/09/16/asp-net-mvc-expression-trees-as-action-parameter.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/04/set-image-as-pdf-background.html</id><title type="text">保护眼睛：给 PDF 设置图片背景</title><summary type="text">从事 IT 行业，免不了经常阅读 PDF 文档。PDF 文档纯白色背景相当刺眼，长时间阅读会导致眼睛干涩疼痛。一些 PDF 阅读软件可以修改背景，但往往只能使用纯色（单一颜色）。PDF 文档使用淡雅的图片作背景，可减缓视觉疲劳，保护我们的眼睛。</summary><published>2011-08-04T14:05:00Z</published><updated>2011-08-04T14:05: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/04/set-image-as-pdf-background.html"/><link rel="alternate" type="text/html" href="http://www.cnblogs.com/ldp615/archive/2011/08/04/set-image-as-pdf-background.html"/><content type="html"/></entry><entry><id>http://www.cnblogs.com/ldp615/archive/2011/08/03/string-format-with-length.html</id><title type="text">这种写法用过没：string.Format(&amp;quot;{0,-10}&amp;quot;, 8)</title><summary type="text">做 .net 开发也若干年了，如此写法确是我第一次见（更别提用了）：string.Format("4G 内存便宜了{0,12:C2}，我打算买{1,4}条", 145, 2);</summary><published>2011-08-03T10:46:00Z</published><updated>2011-08-03T10:46: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/03/string-format-with-length.html"/><link rel="alternate" type="text/html" href="http://www.cnblogs.com/ldp615/archive/2011/08/03/string-format-with-length.html"/><content type="html"/></entry><entry><id>http://www.cnblogs.com/ldp615/archive/2011/08/02/quickly-create-instance-of-iequalitycomparer-and-icomparer.html</id><title type="text">快速创建 IEqualityComparer&amp;lt;T&amp;gt; 和 IComparer&amp;lt;T&amp;gt; 的实例</title><summary type="text">.net 中 IEqualityComparer 和 IComparer 经常在 Linq 和 一些泛型集合、泛型字典类中用作参数。不过因其复杂性，包含 IEqualityComparer 或 IComparer 类型参数的函数一般使用频度不高。尽管如此，有些情况下确非用不可，不得不创建一些新的类来实现 IEqualityComparer 或 IComparer 接口。不但增加了代码量，还对程序结构产生影响，新加入的类命名、放置、共用都是问题。因此，我们期望能简单快速直接的创建 IEqualityComparer 和 IComparer 的实例。</summary><published>2011-08-02T13:14:00Z</published><updated>2011-08-02T13:14: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/02/quickly-create-instance-of-iequalitycomparer-and-icomparer.html"/><link rel="alternate" type="text/html" href="http://www.cnblogs.com/ldp615/archive/2011/08/02/quickly-create-instance-of-iequalitycomparer-and-icomparer.html"/><content type="html"/></entry><entry><id>http://www.cnblogs.com/ldp615/archive/2011/08/02/2125112.html</id><title type="text">何止 Linq 的 Distinct 不给力</title><summary type="text">昨日有文《Linq的Distinct太不给力了》，本文更深一步讨论。.net 中经常把 IEqualityComparer 用作某些重载的参数。虽然这些重载在日常使用中并不频繁， 不过一旦用到，大多要创建新类实现 IEqualityComparer，繁琐不给力。 本文创建 Equality 泛型类，配合一个 lambda 表达式可快速创建 IEqualityComparer 的实例。</summary><published>2011-08-02T10:45:00Z</published><updated>2011-08-02T10: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/08/02/2125112.html"/><link rel="alternate" type="text/html" href="http://www.cnblogs.com/ldp615/archive/2011/08/02/2125112.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/07/20/develop-db-independ-application-with-ado-dot-net.html</id><title type="text">使用 ADO.NET 开发 数据库无关 的 应用程序</title><summary type="text">开发数据库无关的应用程序有很多种方式，本文介绍最基础的一种...</summary><published>2011-07-20T14:06:00Z</published><updated>2011-07-20T14: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/07/20/develop-db-independ-application-with-ado-dot-net.html"/><link rel="alternate" type="text/html" href="http://www.cnblogs.com/ldp615/archive/2011/07/20/develop-db-independ-application-with-ado-dot-net.html"/><content type="html"/></entry><entry><id>http://www.cnblogs.com/ldp615/archive/2011/07/14/dot-net-4-sum-efficiency-test.html</id><title type="text">.NET 求和的效率</title><summary type="text">对 .NET 中各种求和的方式进行效率比较...对一般开发影响不太，对效率要求不高的朋友可无视本文...</summary><published>2011-07-14T05:32:00Z</published><updated>2011-07-14T05:32:00Z</updated><author><name>鹤冲天</name><uri>http://www.cnblogs.com/ldp615/</uri></author><link rel="alternate" href="http://www.cnblogs.com/ldp615/archive/2011/07/14/dot-net-4-sum-efficiency-test.html"/><link rel="alternate" type="text/html" href="http://www.cnblogs.com/ldp615/archive/2011/07/14/dot-net-4-sum-efficiency-test.html"/><content type="html"/></entry><entry><id>http://www.cnblogs.com/ldp615/archive/2011/07/13/dot-net-4-parallel-sum-is-not-effective.html</id><title type="text">.NET 4：并行求和不爽</title><summary type="text">如题，使用 .NET 4 中的并行求和，效率不理想。文中给出一简单的并行求和方法...</summary><published>2011-07-13T12:02:00Z</published><updated>2011-07-13T12:02:00Z</updated><author><name>鹤冲天</name><uri>http://www.cnblogs.com/ldp615/</uri></author><link rel="alternate" href="http://www.cnblogs.com/ldp615/archive/2011/07/13/dot-net-4-parallel-sum-is-not-effective.html"/><link rel="alternate" type="text/html" href="http://www.cnblogs.com/ldp615/archive/2011/07/13/dot-net-4-parallel-sum-is-not-effective.html"/><content type="html"/></entry><entry><id>http://www.cnblogs.com/ldp615/archive/2011/06/29/when-dynamic-meet-internal.html</id><title type="text">当 dynamic 遇上 internal</title><summary type="text">dynamic 免去了反射调用的繁琐和不雅，带来了极大便利。但面对其他程序集中的 internal 类型时 dynamic 表现又如何呢...</summary><published>2011-06-28T23:53:00Z</published><updated>2011-06-28T23:53:00Z</updated><author><name>鹤冲天</name><uri>http://www.cnblogs.com/ldp615/</uri></author><link rel="alternate" href="http://www.cnblogs.com/ldp615/archive/2011/06/29/when-dynamic-meet-internal.html"/><link rel="alternate" type="text/html" href="http://www.cnblogs.com/ldp615/archive/2011/06/29/when-dynamic-meet-internal.html"/><content type="html"/></entry><entry><id>http://www.cnblogs.com/ldp615/archive/2011/06/23/simply-your-code-with-delegate.html</id><title type="text">借助 委托 精简代码</title><summary type="text">相信大多朋友和我一样，每天写代码就会用到 String.Format 这个方法。太经常用，感觉敲起键盘了不是太利索，于是把它精简成一个字母 F，以后代码可以这样写了：var s = F("今天是 {0}", DateTime.Now)。</summary><published>2011-06-23T12:47:00Z</published><updated>2011-06-23T12:47:00Z</updated><author><name>鹤冲天</name><uri>http://www.cnblogs.com/ldp615/</uri></author><link rel="alternate" href="http://www.cnblogs.com/ldp615/archive/2011/06/23/simply-your-code-with-delegate.html"/><link rel="alternate" type="text/html" href="http://www.cnblogs.com/ldp615/archive/2011/06/23/simply-your-code-with-delegate.html"/><content type="html"/></entry></feed>
