UtilWin32SafePInvokeT(ExpressionFuncT, Int32) Method

Invokes a platform invoke encapsulated function, providing a higher safety level for error-handling.

If the function that was called using platform invoke has the SetLastError, then it checks the exit code returned by the function, and, if is not same as successValue, throws the corresponding Win32Exception.

Definition

Namespace: DevCase.Win32
Assembly: DevCase.net48 (in DevCase.net48.dll) Version: 6.0.0.0 (6.0)
XMLNS for XAML: Not mapped to an xmlns.
public static T SafePInvoke<T>(
	Expression<Func<T>> expr,
	int successValue
)

Parameters

expr  ExpressionFuncT
The platform invoke encapsulated function.
successValue  Int32

[Missing <param name="successValue"/> documentation for "M:DevCase.Win32.UtilWin32.SafePInvoke``1(System.Linq.Expressions.Expression{System.Func{``0}},System.Int32)"]

Type Parameters

T
The source value type.

Return Value

T
The type of the return value depends on the function definition.

Example

This is a code example.
C#
No code example is currently available or this language may not be supported.

Exceptions

Win32Exception

See Also