hadashiA / VContainer

The extra fast, minimum code size, GC-free DI (Dependency Injection) library running on Unity Game Engine.
https://vcontainer.hadashikick.jp
MIT License
1.88k stars 163 forks source link

Added a TryResolve method to IObjectResolver #585

Closed AlonTalmi closed 5 months ago

AlonTalmi commented 9 months ago

I added to IObjectResolver the method: bool TryResolve(Type type, out object resolved);

And also added 2 extension methods: TryResolve T TryResolveOrDefault(T defaultValue = default)

I also implemented it in EntryPointDispatcher because it used try-catch to mimic TryResolve

And added few simple unit test (copied from the default resolve method unit tests)

Also allows to add an Optional inject attribute

vercel[bot] commented 9 months ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
vcontainer ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 30, 2023 3:55pm
hadashiA commented 5 months ago

👍

hadashiA commented 5 months ago

Merged in #656