共用方式為


TableEntryExtensions.TryGetValue Method

Definition

Overloads

TryGetValue<T>(ITableEntry, String, T)

Try to get data of type T from an entry.

TryGetValue<T>(ITableEntry, String, T, Func<T>)

Try to get data of type T from an entry.

TryGetValue<T>(ITableEntry, String, T, T)

Try to get data of type T from an entry.

TryGetValue<T>(ITableEntry, String, T)

Try to get data of type T from an entry.

public:
generic <typename T>
[System::Runtime::CompilerServices::Extension]
 static bool TryGetValue(Microsoft::VisualStudio::Shell::TableManager::ITableEntry ^ entry, System::String ^ keyName, [Runtime::InteropServices::Out] T % content);
public:
generic <typename T>
[System::Runtime::CompilerServices::Extension]
 static bool TryGetValue(Microsoft::VisualStudio::Shell::TableManager::ITableEntry ^ entry, Platform::String ^ keyName, [Runtime::InteropServices::Out] T &  content);
public static bool TryGetValue<T> (this Microsoft.VisualStudio.Shell.TableManager.ITableEntry entry, string keyName, out T content);
static member TryGetValue : Microsoft.VisualStudio.Shell.TableManager.ITableEntry * string * 'T -> bool
<Extension()>
Public Function TryGetValue(Of T) (entry As ITableEntry, keyName As String, ByRef content As T) As Boolean

Type Parameters

T

Expected data type.

Parameters

entry
ITableEntry

The entry.

keyName
String

The key.

content
T

The content.

Returns

true if the entry.TryGetValue(...) returned true and the corresponding data was of type T.

Remarks

content will be set to default(T) if entry.TryGetValue(...) returns false or the returned data was not a T.

Applies to

TryGetValue<T>(ITableEntry, String, T, Func<T>)

Try to get data of type T from an entry.

public:
generic <typename T>
[System::Runtime::CompilerServices::Extension]
 static bool TryGetValue(Microsoft::VisualStudio::Shell::TableManager::ITableEntry ^ entry, System::String ^ keyName, [Runtime::InteropServices::Out] T % content, Func<T> ^ defaultValue);
public static bool TryGetValue<T> (this Microsoft.VisualStudio.Shell.TableManager.ITableEntry entry, string keyName, out T content, Func<T> defaultValue);
static member TryGetValue : Microsoft.VisualStudio.Shell.TableManager.ITableEntry * string * 'T * Func<'T> -> bool
<Extension()>
Public Function TryGetValue(Of T) (entry As ITableEntry, keyName As String, ByRef content As T, defaultValue As Func(Of T)) As Boolean

Type Parameters

T

Expected data type.

Parameters

entry
ITableEntry
keyName
String
content
T
defaultValue
Func<T>

Returns

true if the entry.TryGetValue(...) returned true and the corresponding data was of type T.

Remarks

content will be set to defaultValue() if entry.TryGetValue(...) returns false or the returned data was not a T.

Applies to

TryGetValue<T>(ITableEntry, String, T, T)

Try to get data of type T from an entry.

public:
generic <typename T>
[System::Runtime::CompilerServices::Extension]
 static bool TryGetValue(Microsoft::VisualStudio::Shell::TableManager::ITableEntry ^ entry, System::String ^ keyName, [Runtime::InteropServices::Out] T % content, T defaultValue);
public:
generic <typename T>
[System::Runtime::CompilerServices::Extension]
 static bool TryGetValue(Microsoft::VisualStudio::Shell::TableManager::ITableEntry ^ entry, Platform::String ^ keyName, [Runtime::InteropServices::Out] T &  content, T defaultValue);
public static bool TryGetValue<T> (this Microsoft.VisualStudio.Shell.TableManager.ITableEntry entry, string keyName, out T content, T defaultValue);
static member TryGetValue : Microsoft.VisualStudio.Shell.TableManager.ITableEntry * string * 'T * 'T -> bool
<Extension()>
Public Function TryGetValue(Of T) (entry As ITableEntry, keyName As String, ByRef content As T, defaultValue As T) As Boolean

Type Parameters

T

Expected data type.

Parameters

entry
ITableEntry

The entry.

keyName
String

The key.

content
T

The content.

defaultValue
T

The default value.

Returns

true if the entry.TryGetValue(...) returned true and the corresponding data was of type T.

Remarks

content will be set to defaultValue if entry.TryGetValue(...) returns false or the returned data was not a T.

Applies to