EntityConnectionStringBuilder.TryGetValue(String, Object) 方法

定義

從此 EntityConnectionStringBuilder中取得對應所提供金鑰的值。

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

參數

keyword
String

要取回物品的鑰匙。

value
Object

對應於的 keyword值。

傳回

true 若連接字串中發現 keyword;否則為 false

例外狀況

keyword 包含一個空值(Nothing 在 Visual Basic)。

備註

TryGetValue 方法讓開發者能安全地從 取得 EntityConnectionStringBuilder 值,而無需驗證所提供的金鑰名稱是否有效。 TryGetValue 當傳遞不存在的金鑰時,不會產生例外。 使用不存在的金鑰呼叫 TryGetValue,會在 value 參數中放入 null(在 Visual Basic 中Nothing)。

適用於