SPKeyValuePairSerializationInfo.TryGetValue<T> method (String, T, T)
Retrieves a value from the SPKeyValuePairSerializationInfo store based on the specified type and name. This method returns a specified default value if a name cannot be located in the store.
Namespace: Microsoft.SharePoint.Utilities
Assembly: Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Syntax
'Declaration
Public Function TryGetValue(Of T) ( _
name As String, _
<OutAttribute> ByRef value As T, _
defaultValue As T _
) As Boolean
'Usage
Dim instance As SPKeyValuePairSerializationInfo
Dim name As String
Dim value As T
Dim defaultValue As T
Dim returnValue As Boolean
returnValue = instance.TryGetValue(name, _
value, defaultValue)
public bool TryGetValue<T>(
string name,
out T value,
T defaultValue
)
Type parameters
- T
The type of the value to be retrieved.
Parameters
name
Type: System.StringThe name associated with the value to be retrieved.
value
Type: TThe object of the specified type that is associated with the specified name, if it is found in the store; otherwise, the specified default value.
defaultValue
Type: TThe default value to be returned if the specified name is not found in the store.
Return value
Type: System.Boolean
Returns true if the store contains a value with the specified name; otherwise, this method returns false.
Remarks
If the name parameter is null, an exception of type System.ArgumentNullException is thrown.
See also
Reference
SPKeyValuePairSerializationInfo class