最近,在与同事进行协同编程时,我们开始讨论在C#中初始化新对象的最佳方法.我一直是使用构造函数实现,尽管他倾向于静态工程方法.这引起了关于每种类型的利弊的大量来来回回的讨论. 为了说明我所说的内容,这是两个例子: // Using the constructor SqlConnection myConnection = new SqlConnection(connectionString); // Using a static factory method IDbConnection myCon…
Introduction Why an article on "colors"? It's the same question I asked myself before writing this series. The fact is, in .NET, there are only two color formats that can be used: the RGB color model and the HSB color model. Those two are encaps…