CollectionsExtensionTryRemoveTKey, TValue 方法
尝试从字典中移除指定键的值。
命名空间: TouchSocket.Core程序集: TouchSocket.Core (在 TouchSocket.Core.dll 中) 版本:4.0.0-beta.143+5fcca7a4e70968794985dc3793adc50531308be6
public static bool TryRemove<TKey, TValue>(
this IDictionary<TKey, TValue> dictionary,
TKey key,
out TValue value
)
<ExtensionAttribute>
Public Shared Function TryRemove(Of TKey, TValue) (
dictionary As IDictionary(Of TKey, TValue),
key As TKey,
<OutAttribute> ByRef value As TValue
) As Boolean
[<ExtensionAttribute>]
static member TryRemove :
dictionary : IDictionary<'TKey, 'TValue> *
key : 'TKey *
value : 'TValue byref -> bool
- dictionary IDictionaryTKey, TValue
- 要操作的字典。
- key TKey
- 要移除的键。
- value TValue
- 如果移除成功,则包含移除的值;否则为默认值。
- TKey
- 字典中键的类型。
- TValue
- 字典中值的类型。
Boolean如果成功移除并返回了值,则为 true;否则为 false。在 Visual Basic 和 C# 中,这个方法可以当成为类型
IDictionaryTKey,
TValue 的实例方法来调用。在采用实例方法语法调用这个方法时,请省略第一个参数。请参考
扩展方法 (Visual Basic) 或
扩展方法 (C# 编程指南) 获取更多信息。