 | AttributeTableExtensionsGetValueOrDefaultT Method |
Tries to get the value of the attribute with the specified key. If not found,
the specified default value is returned.
Namespace: Slash.Collections.AttributeTablesAssembly: Slash.Collections (in Slash.Collections.dll) Version: 1.0.6018.40177
Syntaxpublic static T GetValueOrDefault<T>(
this IAttributeTable attributeTable,
Object key,
T defaultValue
)
where T : class
<ExtensionAttribute>
Public Shared Function GetValueOrDefault(Of T As Class) (
attributeTable As IAttributeTable,
key As Object,
defaultValue As T
) As T
public:
[ExtensionAttribute]
generic<typename T>
where T : ref class
static T GetValueOrDefault(
IAttributeTable^ attributeTable,
Object^ key,
T defaultValue
)
[<ExtensionAttribute>]
static member GetValueOrDefault :
attributeTable : IAttributeTable *
key : Object *
defaultValue : 'T -> 'T when 'T : not struct
Parameters
- attributeTable
- Type: Slash.Collections.AttributeTablesIAttributeTable
Attribute table to work on. - key
- Type: SystemObject
Key to retrieve the value of. - defaultValue
- Type: T
Default value to use if attribute wasn't found.
Type Parameters
- T
- Expected type of attribute. Only classes are allowed as the method wouldn't be AOT compatible otherwise.
Return Value
Type:
TValue of attribute with specified key, if found. Specified default value otherwise.
Usage Note
In Visual Basic and C#, you can call this method as an instance method on any object of type
IAttributeTable. When you use instance method syntax to call this method, omit the first parameter. For more information, see
Extension Methods (Visual Basic) or
Extension Methods (C# Programming Guide).
See Also