ConditionalWeakTable<TKey,TValue>.Remove(TKey) 方法

定义

从表中移除某个键及其值。Removes a key and its value from the table.

public:
 bool Remove(TKey key);
public bool Remove (TKey key);
member this.Remove : 'Key -> bool
Public Function Remove (key As TKey) As Boolean

参数

key
TKey

要移除的键。The key to remove.

返回

Boolean

如果找到并移除该键,则为 true;否则为 falsetrue if the key is found and removed; otherwise, false.

例外

keynullkey is null.

注解

如果在此操作过程中对密钥进行垃圾回收,则该方法不会引发异常,并且返回值是不确定的。If the key is garbage-collected during this operation, the method does not raise an exception and the return value is undefined.

适用于