IOptionsMonitorCache<TOptions>.TryAdd(String, TOptions) 方法

定义

尝试向缓存添加新选项,如果该名称已存在,则将返回 false。Tries to adds a new option to the cache, will return false if the name already exists.

public:
 bool TryAdd(System::String ^ name, TOptions options);
public bool TryAdd (string name, TOptions options);
abstract member TryAdd : string * 'Options -> bool
Public Function TryAdd (name As String, options As TOptions) As Boolean

参数

name
String

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

options
TOptions

选项实例。The options instance.

返回

Boolean

是否添加了任何内容。Whether anything was added.

适用于