Extension Methods for retrieving a value from an interface
Namespace: Nehta.VendorLibrary.CommonAssembly: Nehta.VendorLibrary.Common (in Nehta.VendorLibrary.Common.dll) Version: 3.0.2.0 (1.0.0.0)
Syntax
C# |
---|
public static TExpected GetAttributeValue<T, TExpected>(
this Object obj,
Func<T, TExpected> expression,
string interfaceName
)
where T : class
|
Visual Basic |
---|
<ExtensionAttribute> _
Public Shared Function GetAttributeValue(Of T As Class, TExpected) ( _
obj As Object, _
expression As Func(Of T, TExpected), _
interfaceName As String _
) As TExpected |
Visual C++ |
---|
[ExtensionAttribute]
public:
generic<typename T, typename TExpected>
where T : ref class
static TExpected GetAttributeValue(
Object^ obj,
Func<T, TExpected>^ expression,
String^ interfaceName
) |
Parameters
- obj
- Type: System..::..Object
The object this method extends
- expression
- Type: System..::..Func<(Of <(<'T, TExpected>)>)>
An expression specifying the property on the attribute you would like to retrun
- interfaceName
- Type: System..::..String
Name of the expected interface; E.g. the interface containing the attribute
Type Parameters
- T
- The object / attribute type
- TExpected
- The expected return value type
Return Value
The value as specified by the expression parameter
Usage Note
In Visual Basic and C#, you can call this method as an instance method on any object of type
Object. When you use instance method syntax to call this method, omit the first parameter. For more information, see
or
.
See Also