[This is preliminary documentation and is subject to change.]
Tries to find an item by name, and returns it if it is found, otherwise calls a factory function supplying context value and registers the obtained
new item. The first lookup is performed in a lock-free way and if an item is found then it is immediately returned.
The second check and factory call operation is performed atomically under the lock to ensure consistency
Namespace: NFXAssembly: NFX (in NFX.dll) Version: 3.0.0.1 (3.0.0.1)
public T GetOrRegister<TContext>(
string name,
Func<TContext, T> regFactory,
TContext context,
out bool wasAdded
)
public T GetOrRegister<TContext>(
string name,
Func<TContext, T> regFactory,
TContext context,
out bool wasAdded
)
Public Function GetOrRegister(Of TContext) (
name As String,
regFactory As Func(Of TContext, T),
context As TContext,
<OutAttribute> ByRef wasAdded As Boolean
) As T
Public Function GetOrRegister(Of TContext) (
name As String,
regFactory As Func(Of TContext, T),
context As TContext,
<OutAttribute> ByRef wasAdded As Boolean
) As T
public:
generic<typename TContext>
T GetOrRegister(
String^ name,
Func<TContext, T>^ regFactory,
TContext context,
[OutAttribute] bool% wasAdded
)
public:
generic<typename TContext>
T GetOrRegister(
String^ name,
Func<TContext, T>^ regFactory,
TContext context,
[OutAttribute] bool% wasAdded
)
member GetOrRegister :
name : string *
regFactory : Func<'TContext, 'T> *
context : 'TContext *
wasAdded : bool byref -> 'Tmember GetOrRegister :
name : string *
regFactory : Func<'TContext, 'T> *
context : 'TContext *
wasAdded : bool byref -> 'T- TContext
Return Value
Type:
T