Can dependency injection save memory space?
I am having a large array of large objects in a C# server application. A lot of object properties have usually default values.
Is it worth looking at trying dependency injec开发者_运维技巧tion to optimize or reduce memory usage in my application?
This is only loosely related to dependency injection - you can factor out the commonality and use the same immutable object instance to represent the shared state. How you create/access this shared object (also see flyweight pattern) is another thing, as suggested it could be via DI or a factory method.
精彩评论