IOptionsMonitorCache<TOptions>.GetOrAdd(String, Func<TOptions>) 方法

定义

获取已命名的选项实例,或添加使用 createOptions 创建的新实例。Gets a named options instance, or adds a new instance created with createOptions.

public:
 TOptions GetOrAdd(System::String ^ name, Func<TOptions> ^ createOptions);
public TOptions GetOrAdd (string name, Func<TOptions> createOptions);
abstract member GetOrAdd : string * Func<'Options (requires 'Options : null)> -> 'Options
Public Function GetOrAdd (name As String, createOptions As Func(Of TOptions)) As TOptions

参数

name
String

选项实例的名称。The name of the options instance.

createOptions
Func<TOptions>

用于创建新实例的函数。The func used to create the new instance.

返回

TOptions

选项实例。The options instance.

适用于