享受代码,享受人生

SOA is an integration solution. SOA is message oriented first.
The Key character of SOA is loosely coupled. SOA is enriched
by creating composite apps.
  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

随笔分类 -  Windbey

摘要:有一位朋友在看了我有关List的介绍后, 觉得List的功能很强大, 于是乎看到集合就想用它.不过之前一直提倡Design to interface, 按照这样的思想我们在变量的声明(declare)以及方法的签名(signature)中还是应该尽可能的使用IList. 如下所示: class Demo{ private IList list=new List; public voi... 阅读全文

posted @ 2005-09-05 19:28 idior 阅读(6207) 评论(17) 推荐(0) 编辑

摘要:在很多场合下, 你需要在主(UI)线程中运行一些比较耗时间的任务,比如以下的任务 l Image downloadsl Web service invocationsl File downloads and uploads (including for peer-to-peer applications)l Complex local computationsl Database transact... 阅读全文

posted @ 2005-08-18 16:15 idior 阅读(8521) 评论(10) 推荐(1) 编辑

摘要:Ms 前不久推出了101 sample for vs2005(C# & VB). 里面有.Net 2.0在各种应用下的小例子. 可以说是学习了解.Net2.0新特性的最好的资料. 如果大家对此感兴趣不如每个对自己感兴趣的例子做些小结, 人多力量大. 这样学习起来会快很多. 不知道有没有人响应? 并且最后可以将比较好的总结装订成册. 也算是博客园对推广.net做的一大贡献. 希望dudu尽快开通有... 阅读全文

posted @ 2005-08-17 11:48 idior 阅读(2295) 评论(10) 推荐(0) 编辑

摘要:根据Program to interface的原理, 我们应该尽可能的使用接口而不是具体类. 因此在集合操作和算法中我们应该尽可能的使用ICollection和IList.象下面这样 public void ListAlogrithm(IList list) { //Do something to list } 而不是使用List 等等具体的... 阅读全文

posted @ 2005-08-15 20:28 idior 阅读(4806) 评论(4) 推荐(0) 编辑

摘要:在谈具体实现前 先介绍一下三种事务:1. 单对象单资源2. 多对象单资源3. 多对象多资源(分布式事务, 使用两段提交协议)在ADO.Net1.0下有两种使用Transaction的方法. 一种是在需要事务的对象中显式的调用事务处理, 还有一种是使用Enterprise Service的声明式的方法.第一种方法的示例代码如下: publicvoidTransactionTest(){stringc... 阅读全文

posted @ 2005-08-15 20:28 idior 阅读(13657) 评论(12) 推荐(2) 编辑

摘要:Martin Fowler昨天发布了一篇有关Collection Closure的文章, 文中以Ruby为例展示了Collection Closure的强大,方便. 对照着他的例子, Demo了一下在C#中如何实现类似的功能.Example 1employees.each do |e| e.doSomething end31 employees.ForEach(delegate(Employee ... 阅读全文

posted @ 2005-08-02 13:13 idior 阅读(2563) 评论(5) 推荐(0) 编辑

摘要:这个问题是很久以前在一个老外的blog上看到的,当时没有很在意,最近看了CAB(Composition UI Application Block)的源码后, 又想到它.利用泛型来确保参数的类型安全, 我想这是泛型的重要意义之一.但是利用泛型完成返回值类型(Return Value Typr)的自动转化(Casting), 你想过没有?以GetService方法为例, 在没有泛型的时候是这样的. ... 阅读全文

posted @ 2005-08-01 15:46 idior 阅读(2095) 评论(6) 推荐(0) 编辑

摘要:如果你想为一个线程传入变量你怎么办? ThreadStart可不支持带参数的方法.所以你无法使用Thread来启动一个带参数的方法.. ThreadStartmyThreadDelegate=newThreadStart(ThreadMethod);//publicdelegatevoidThreadStart();ucan'tpassaParameterThreadmyThread=newThr... 阅读全文

posted @ 2005-07-25 22:15 idior 阅读(11531) 评论(13) 推荐(1) 编辑

摘要:下面这段代码为什么无法编译? usingSystem; usingSystem.Collections.Generic; usingSystem.Drawing; namespaceGenicTest { classProgram { staticvoidMain(string[]args) { ... 阅读全文

posted @ 2005-05-11 16:40 idior 阅读(3319) 评论(35) 推荐(0) 编辑

摘要:What's this mean? System.PlatformId in 1.1 namespace System { public enum PlatformID { // Fields Win32NT = 2, Win32S = 0, Win32Windows = 1,WinCE = 3 } } System.PlatformId in 2.0 namespace Sys... 阅读全文

posted @ 2005-04-25 21:53 idior 阅读(1394) 评论(2) 推荐(0) 编辑

摘要:很有意思的一个泛型集合类, 不过由于它属于System.ComponentModel名空间估计很容易被人遗忘. 主要特点在于它可以在加入新的元素或者元素发生修改的时候触发相应的事件, 而在基本集合类中是不具有这些功能的,而且由于在基本集合中Add方法不是Virtual方法,要想让它触发时间还真不是很方便.不过BindingList可以很好的满足你的功能. 下面的示例中使用List界面上不会立即... 阅读全文

posted @ 2005-04-25 19:14 idior 阅读(2380) 评论(2) 推荐(0) 编辑

摘要:.Net的新功能: 泛型,匿名方法,新的迭代器 这些功能都是与集合的应用紧密相关的,希望以后能有新的发现,将这个系列完善.欢迎提出你的看法 .Net2.0的集合操作 --- What i know? .Net2.0的集合操作 --- What i hope? .Net2.0的集合操作 --- What i forgot? CollectionClosureMethod in .NetArray &... 阅读全文

posted @ 2005-04-25 00:04 idior 阅读(4295) 评论(1) 推荐(0) 编辑

摘要:好像一个状态机? 不是太懂 using System; using System.Collections.Generic; using System.Text; using System.Collections; namespace CollectionFrameWork { public class Game { IEnumerator white; ... 阅读全文

posted @ 2005-04-24 23:28 idior 阅读(1326) 评论(0) 推荐(0) 编辑

摘要:.Net2.0中提供的Array类 namespace System { public abstract class Array { public static TOutput[] ConvertAll(TInput[] input, Converter cc); public static bool Exists(T[] array, Predicate match);... 阅读全文

posted @ 2005-04-24 22:26 idior 阅读(2837) 评论(4) 推荐(0) 编辑

摘要:1.按住Alt键选择文本. 试试看很cool的功能.虽然2003已经有了不过我是今天才知道. 2.在打开多个文件后 Ctrl+Tab 自己试试看吧. 3.还有在标签页(Tab)上点击右键, 有一个很有用的命令 Open Containing Folder(早想有这个玩意了) 以后准备随时记一些IDE的小Tips. 充分发挥IDE的作用.当然大家都知道的就不用记了. 比如重构,Auto Forma... 阅读全文

posted @ 2005-04-24 17:11 idior 阅读(1938) 评论(10) 推荐(0) 编辑

摘要:在我以前的一篇随笔中曾提到不要在代码中散布遍历集合的操作.而是将遍历集合的操作放入集合本身. 当时就想在.Net1.0中需要自己做Typed Collection,这样当然可以把遍历集合的操作放入集合本身. 可是在.Net2.0中提供了泛型机制,我总不能为了隐藏遍历集合的操作而复古(自己做Typed Collection)吧. 幸运的是发现.Net2.0已经为我想到这点了.你会发现在.Net2.0... 阅读全文

posted @ 2005-04-23 13:49 idior 阅读(5228) 评论(8) 推荐(0) 编辑