【发布时间】:2011-03-30 06:42:51
【问题描述】:
我目前有一个这种形式的课程:
class Abc {
private readonly IDisposable disposable;
public Abc(IDisposable disposable) {
this.disposable = disposable;
}
...
}
现在,我想知道如何使用
将IDisposable 绑定到 Bitmap
Bitmap(int widht, int height)
构造函数。
我已尝试使用以下代码,但似乎没有:
class TestModule : NinjectModule {
public override void Load()
{
Bind<IDisposable>().To<Bitmap>()
.WithConstructorArgument("width", 10)
.WithConstructorArgument("height", 22)
;
}
}
【问题讨论】:
标签: c# dependency-injection ioc-container ninject