开发者

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜