C#

posted @ 2009-02-13 10:54 Adrian H. 阅读(919) | 评论 (4) 编辑 |

posted @ 2008-02-16 23:07 Adrian H. 阅读(671) | 评论 (0) 编辑 |

posted @ 2008-02-05 21:23 Adrian H. 阅读(543) | 评论 (1) 编辑 |

posted @ 2007-12-06 11:19 Adrian H. 阅读(371) | 评论 (0) 编辑 |

posted @ 2007-11-22 16:27 Adrian H. 阅读(1778) | 评论 (4) 编辑 |

摘要:
扩展方法本质上只是一个编译器级别的语法糖, 但不引用.NET Framework 3.5的程序集却无法发布程序到 2.0/3.0版本的运行环境中, 因为它将使那些方法(扩展方法)带上ExtensionAttribute属性, 而就是 ExtensionAttribute这个类却存在于.NET Framework 3.5的程序集中. 其实只要使用一个小技巧即可以保证带有扩展方法的程序在Target到.NET Framework 2.0/3.0时通过编译...
阅读全文

posted @ 2007-11-17 22:19 Adrian H. 阅读(703) | 评论 (0) 编辑 |

摘要: ??可能是一个被遗忘的运算符,很少看到有人用它,它的用法很简单却很实用阅读全文

posted @ 2007-09-29 11:30 Adrian H. 阅读(2995) | 评论 (11) 编辑 |

摘要: NSweetie是一个轻量, 高效, 方便的数据访问组件. 用户创建好数据库后, 只需要提供数据操作的接口定义, 输入什么参数以及得到什么数据或实体, 其他的事情全部交给NSweetie吧! 组件不是魔法, 依然需要生成代码, NSweetie生成的代码的方式是通过System.Reflection.Emit的API直接生成MSIL, 用户看不到任何CSharp代码.. 其实, 也不需要看到....阅读全文

posted @ 2007-09-07 17:20 Adrian H. 阅读(2192) | 评论 (10) 编辑 |

摘要: LINQ TO SQL作为一个对SQL Server特性完全支持的数据访问组件, 强大也是要付出性能代价的, 于是我想自己实现一个类似的组件, 这两天连续设计和编码, 基本实现了预定的功能, 包括对定义的实体的CRUD操作, 存储过程的代码生成. 组件的使用者只需要编写类, 定义实体的各个属性以及对应表, 列属性, 组件可以动态生成从SqlDataReader到实体的映射代码, 所谓动态是通过在运行时Emit IL, 获取这一段映射的代码, 通过良好的类层次设计只需要Emit所需要的很少量的中间代码, 对于一个实体类型只需要生成一次, 许多Emit过程所必要的对象都缓存在了static字段中, 所以Emit的过程是很高效的, 使用Profiler可以看到生成一个对于的类型只需要几十ms~100ms左右; 对于存储过程, 用户提供一个存储过程对于的接口, 组件将提供一个实现该接口的对象, 用户则可以使用它很方便的调用存储过程.阅读全文

posted @ 2007-08-25 09:05 Adrian H. 阅读(1133) | 评论 (7) 编辑 |

摘要: C# code snippet below is an illustration of the Cooky-Turkey algorithm, the performance may suck when processing huge datasets, but you can use arrays of double instead of arrays of complex number structure to reduce the performance impact by object initializations and method invocations(overloaded operators).阅读全文

posted @ 2007-08-10 15:30 Adrian H. 阅读(2268) | 评论 (3) 编辑 |

摘要: PGM(Portable Gray Map) is an image format which uses 1 or 2 byte to store a grayscale pixel, the format specification is simple and straight forward, detail specification can be seen here

So, writing a simple converter from PGM to the most common used BMP format is really an easy job.
阅读全文

posted @ 2007-08-07 13:56 Adrian H. 阅读(1443) | 评论 (1) 编辑 |

摘要: 介绍几个未公开的C#关键字, 好像没什么大用处, 只是了解了CLI的一些东西阅读全文

posted @ 2007-07-25 02:26 Adrian H. 阅读(597) | 评论 (2) 编辑 |

posted @ 2007-06-27 22:00 Adrian H. 阅读(1876) | 评论 (2) 编辑 |

摘要: Visual Studio codename Orcas beta 1 都出来了, 感受一下带有新语法特性的 C# 3.0 吧. 有人觉得新语法很杂, 甚至觉得 C# 越来越不像它自己了, 其实... 它一点都没变...阅读全文

posted @ 2007-05-19 10:47 Adrian H. 阅读(3637) | 评论 (12) 编辑 |

摘要: This is a tutorial on using Functional Programming (FP) techniques for constructing LINQ queries. It is certainly possible to write simple LINQ queries without using these techniques, but as soon as you start writing more complicated queries, you need to understand these techniques.阅读全文

posted @ 2007-04-13 12:17 Adrian H. 阅读(544) | 评论 (0) 编辑 |

摘要: 操作系统概念中"哲学家就餐问题"的C#模拟阅读全文

posted @ 2007-04-01 19:04 Adrian H. 阅读(671) | 评论 (0) 编辑 |

摘要: 结论是: 有的产生, 有的不产生阅读全文

posted @ 2007-03-18 15:36 Adrian H. 阅读(210) | 评论 (0) 编辑 |

摘要: 一种避免由于Delegate造成引用导致GC无法回收被引用对象的办法..阅读全文

posted @ 2007-03-11 20:34 Adrian H. 阅读(1159) | 评论 (6) 编辑 |

摘要: Scott Guthrie介绍的C# 3.0中的语言新特性阅读全文

posted @ 2007-03-11 11:24 Adrian H. 阅读(307) | 评论 (0) 编辑 |

posted @ 2006-10-28 11:31 Adrian H. 阅读(240) | 评论 (1) 编辑 |

posted @ 2006-10-06 16:01 Adrian H. 阅读(138) | 评论 (0) 编辑 |

posted @ 2006-09-24 13:27 Adrian H. 阅读(526) | 评论 (0) 编辑 |