开发者

Can dependency injection save memory space?

开发者 https://www.devze.com 2023-02-22 19:38 出处:网络
I am having a large array of large objects in a C# server application. A lot of object properties have usually default values.

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

精彩评论

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