Examples of IOC/DI over Singleton

Posted by Amitd on Stack Overflow See other posts from Stack Overflow or by Amitd
Published on 2011-01-10T06:24:54Z Indexed on 2011/01/10 6:53 UTC
Read the original article Hit count: 389

Hi,

Just started learning/reading about DI and IOC frameworks.

Also I read many articles on SO and internet that say that one should prefer DI/IOC over singleton.

Can anyone give/link examples of exactly how DI/IOC eliminates/solves the various issues regarding the Singleton pattern?
(hopefully code and explanation for better understanding)

Also given a system has already implemented Singleton pattern,
how to refactor/implement DI/IOC for the same? (any examples for the same?)

(Language/Framework no bars..C# would be helpful)

Thanks

© Stack Overflow or respective owner

Related posts about design-patterns

Related posts about dependency-injection