摘要:
MSDN建议按照下面的模式实现IDisposable接口: public class Foo: IDisposable { public void Dispose() { Dispose(true); GC.SuppressFinalize(this); } protected virtual vo 阅读全文
摘要:
在软件开发过程中我们经常遇到某个类的成员变量越来越多,显的乱糟糟的,有没有一种优雅的解决方法呢?如果大多是BOOL型可以使用BitArray来管理这些变量,其它类型可以创建一个数据结构包含进去。 BitArray: Manages a compact array of bit values, whi 阅读全文
摘要:
The Aggregate<TSource>(IEnumerable<TSource>, Func<TSource, TSource, TSource>) method makes it simple to perform a calculation over a sequence of value 阅读全文
摘要:
BlockingCollection是一个线程安全的生产者-消费者集合。 代码 public class BlockingTest { BlockingCollection<int> bc = new BlockingCollection<int>(); public BlockingTest() 阅读全文