AdvancedExtensionsSetItem Method

Simple Injector
Stores an item by the given key in the container.

Namespace:  SimpleInjector.Advanced
Assembly:  SimpleInjector (in SimpleInjector.dll) Version: 4.0.0
Syntax

public static void SetItem(
	this Container container,
	Object key,
	Object item
)

Parameters

container
Type: SimpleInjectorContainer
The container.
key
Type: SystemObject
The key of the item to insert or override.
item
Type: SystemObject
The actual item. May be null.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type Container. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
Exceptions

ExceptionCondition
ArgumentNullExceptionThrown when either container or key is a null reference (Nothing in VB).
Remarks

Thread-safety: Calls to this method are thread-safe, but users should take proper percussions when they call both GetItem(Container, Object) and SetItem.
See Also

Reference