开发者

How does Unity resolve types that have not been registered?

开发者 https://www.devze.com 2023-01-07 06:54 出处:网络
I\'ll ad开发者_运维百科mit it, I\'m too lazy to look at the source code. Does anyone know?Never mind, I found the answer at MSDN:

I'll ad开发者_运维百科mit it, I'm too lazy to look at the source code. Does anyone know?


Never mind, I found the answer at MSDN:

You can use the Unity container to generate instances of any object that has a public constructor (in other words, objects that you can create using the new operator), without registering a mapping for that type with the container. When you call the Resolve method and specify the default instance of a type that is not registered, the container simply calls the constructor for that type and returns the result.

0

精彩评论

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

关注公众号