Skip to content

Note on performance of `IsRegistered(Type type)` method

Eugene Sadovoi edited this page Aug 24, 2018 · 1 revision

It used to be very expensive to check if certain type is registered with Unity container.

Not any more!

Current implementation uses very efficient and fast algorithm to check for existing registration. It takes about one third (1/3) of fastest resolve time to check for existing registration. So, finally code like this could be run efficiently:

if (!container.IsRegistered(type))
    container.RegisterType<...>(...);