- update code block

master
Simon Gockner 7 years ago
parent 8a6a14669d
commit 4e64bc79c0
  1. 7
      Lifestyles.md

@ -32,7 +32,12 @@ container.Register(RegistrationFactory.Register<IFoo, Foo>(Lifestyle.Singleton))
When using the `Multiton`-Lifestyle, a new instance gets created if the given scope has no created instance yet. Otherwise the already created instance is used.
`Multiton` instances will be created the first time they are requested for a given scope and then reused whenever requested for their scope.
They are also bound to the `IocContainer` but different to singletons, they can be cleared when you need to do so by calling `IocContainer.ClearMultitonInstances<T>()`.
They are also bound to the `IocContainer` but different to singletons, they can be cleared when you need to do so by calling:
```c#
IocContainer.ClearMultitonInstances<T>()
```
They will also be released once the `IocContainer` is disposed.
This is how you register a class as `Multiton`:

Loading…
Cancel
Save