What is IoC in .NET [duplicate]
Possible Duplicate:
What is Inversion of Control?
I am not familiar with Invers开发者_JAVA百科ion of Control (IoC). What is IoC and how can applications benefit from using IOC. How is it implemented in .NET with C#?
If you have a set of classes that depend on eachother, it's difficult to replace some class for another (better/cheaper/faster) class that does the same job. In order to make your code more flexible, you can use dependency injection.
An easy to use DI framework for C# is Ninject. They have a very understandable tutorial about this subject.
Links:
http://ninject.org/learn
http://blog.andresays.org/2010/10/dependency-injection-with-ninject-and-asp-net-mvc/
Good luck!
精彩评论