ControlExtensionsSafeInvoke(Control, Delegate, Object) Method
Safely executes the specified
Delegate delegate on the thread that
owns the source control's underlying window handle.
This method automatically determines if the caller must call
Invoke(Delegate, Object) method when making
method calls to the source control on a different thread than the
one the control was created on.
Namespace: DevCase.Extensions.ControlExtensionsAssembly: DevCase.net48 (in DevCase.net48.dll) Version: 6.0.0.0 (6.0)
XMLNS for XAML: Not mapped to an xmlns.
public static Object SafeInvoke(
this Control control,
Delegate method,
params Object[] args
)
<ExtensionAttribute>
Public Shared Function SafeInvoke (
control As Control,
method As Delegate,
ParamArray args As Object()
) As Object
Dim control As Control
Dim method As [Delegate]
Dim args As Object()
Dim returnValue As Object
returnValue = control.SafeInvoke(method,
args)
public:
[ExtensionAttribute]
static Object^ SafeInvoke(
Control^ control,
Delegate^ method,
... array<Object^>^ args
)
[<ExtensionAttribute>]
static member SafeInvoke :
control : Control *
method : Delegate *
args : Object[] -> Object
No code example is currently available or this language may not be supported.
- control Control
-
The control on which to invoke the delegate.
- method Delegate
-
A delegate to a method that takes parameters of the same
number and type that are contained in the args parameter.
- args Object
-
An array of objects to pass as arguments to the specified method.
This parameter can be null if the method takes no arguments.
Object
An Object that contains the return value from the delegate being invoked,
or null if the delegate has no return value.
In Visual Basic and C#, you can call this method as an instance method on any object of type
Control. 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).