RouteValueDictionary.TryGetValue(String, Object) Método

Definição

Obtém um valor que indica se um valor está associado à chave especificada.Gets a value that indicates whether a value is associated with the specified key.

public:
 virtual bool TryGetValue(System::String ^ key, [Runtime::InteropServices::Out] System::Object ^ % value);
public bool TryGetValue (string key, out object value);
abstract member TryGetValue : string * obj -> bool
override this.TryGetValue : string * obj -> bool
Public Function TryGetValue (key As String, ByRef value As Object) As Boolean

Parâmetros

key
String

A chave do valor a ser obtido.The key of the value to get.

value
Object

Quando esse método retorna, ele contém o valor associado à chave especificada, caso a chave seja encontrada; caso contrário, contém o valor padrão adequado para o tipo do parâmetro value que você forneceu como um parâmetro out.When this method returns, contains the value that is associated with the specified key, if the key is found; otherwise, contains the appropriate default value for the type of the value parameter that you provided as an out parameter. Este parâmetro é passado não inicializado.This parameter is passed uninitialized.

Retornos

Boolean

true se o dicionário contiver um elemento que tem a chave especificada; caso contrário, false.true if the dictionary contains an element that has the specified key; otherwise, false.

Comentários

Esse método combina a funcionalidade do ContainsKey método e da Item[] propriedade.This method combines the functionality of the ContainsKey method and the Item[] property.

Se a chave não for encontrada, o value parâmetro será atribuído ao valor padrão apropriado para o tipo, como 0 (zero) para tipos de inteiros, false para tipos booleanos e null para tipos de referência.If the key is not found, the value parameter is assigned the appropriate default value for the type, such as 0 (zero) for integer types, false for Boolean types, and null for reference types.

Aplica-se a