TypeExtensions.CoerceCast Method
Attempts to coerce one type into another type by using a conversion expression. Falls back to attempting a conversion to a string if the requested conversion fails. This element is introduced in Windows PowerShell 5.0.
Namespace: Microsoft.OneGet.Utility.Extensions
Assembly: Microsoft.OneGet.Utility (in Microsoft.OneGet.Utility.dll)
Usage
'Usage
Dim type As Type
Dim obj As Object
Dim returnValue As Object
returnValue = TypeExtensions.CoerceCast(type, obj)
Syntax
'Declaration
<ExtensionAttribute> _
Public Shared Function CoerceCast ( _
type As Type, _
obj As Object _
) As Object
[ExtensionAttribute]
public static Object CoerceCast (
Type type,
Object obj
)
[ExtensionAttribute]
public:
static Object^ CoerceCast (
Type^ type,
Object^ obj
)
/** @attribute ExtensionAttribute() */
public static Object CoerceCast (
Type type,
Object obj
)
ExtensionAttribute
public static function CoerceCast (
type : Type,
obj : Object
) : Object
Parameters
- type
- obj
Return Value
Returns Object.
Thread Safety
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Platforms
Target Platforms
See Also
Reference
TypeExtensions Class
TypeExtensions Members
Microsoft.OneGet.Utility.Extensions Namespace