今天读王翔的《设计模式 – 基于C#的工程化实现及扩展》,刚把第一章读完。作为一个C#初学者和工作者,发现了55页,也就是第一章的最后一段关于依赖注入的实例代码中有一个很明显的错误。本来想直接联系作者的,可是实在找不到他的联系方式,就发在自己博客上了。如果同样读过这本书的人能看到,不胜荣幸。
代码如下:
[AttributeUsage(AttributeTargets.Class), AllowMultiple=true]
sealed class DecoratorAttribute : Attribute
{
public readonly object Injector;
private Type type;
public DecoratorAttribute(Type type)
{
if (type == null) throw new ArgumentNullException("type");
this.type = type;
[...]
姓名:郑玏
性别:男
职业:IT工程师
爱好:KTV、乒乓球、台球、五子棋、围棋、编程
语言:中文、英语、闽南语
Email: