Memento pattern enables an object to restore to its previous state. It consists of three classes. Originator is the one who has an internal state. It can… Read more “DESIGN PATTERNS 2 — Memento Pattern”
Author: Minghua Tong
Design Patterns 1 — UML Basics
This will be a serie of articles about Design Patterns. To describe the patterns, we must have some basic knowledge of UML. UML uses ‘+’, ‘-‘ and… Read more “Design Patterns 1 — UML Basics”
Collection Initializer
If you want to use collection initializer to initialize a instance of a collection class, there are two prerequisites: The collection class must implement IEnumerable. The collection… Read more “Collection Initializer”
IEnumerable and IEnumerator
foreach is pretty convenient in C#. It requires the iterated collection implemented IEnumerable or IEnumerable<T>. You can see that there’s only one method in this interface which… Read more “IEnumerable and IEnumerator”
GC, Finalizer and Disposal
我花了2天时间,研究了.Net的垃圾处理机制,最终理解了Dispose Patter。好吧,先从一些概念开始。 memory management Processes don’t access physical memory directly, they use virtual space address. Every process has its own, separate virtual address space. By default, on… Read more “GC, Finalizer and Disposal”
Generic Variance
The line 2 of the above code tried to convert IEnumerable<string> to IEnumerable<object>. You can see that the generic type is converted from string to object. This… Read more “Generic Variance”
Variable vs Variant
VariableAn element, feature, or factor that is liable to vary or change. 有able后缀嘛,自然是强调“能变”,所以翻译成变量,即能变的量。“There are too many variables involved to make any meaningful prediction.” VariantA form or version… Read more “Variable vs Variant”
Parameter VS Argument
一个困扰了我n年的概念…说出来都让人笑话… Parameter is variable in the declaration of function. It’s formal parameter —— 形参。 Argument is the actual value of this variable that gets passed to function. It’s actual parameter ——… Read more “Parameter VS Argument”
.Net Assembly and Module
时不时地在.Net中接触到module这个概念,费解了好久。 先说说Assembly吧,一个dll或者一个exe就是一个assembly。Physically, we can compile related code files into an assembly. Assembly is the minimum unit of deployment.Logically, an assembly can have one or more modules which are… Read more “.Net Assembly and Module”
Autofac入门
“Autofac is an addictive IoC container for .NET. It manages the dependencies between classes so that applications stay easy to change as they grow in size and complexity. This is achieved… Read more “Autofac入门”