Edit

Share via


SecurityContext.Run(SecurityContext, ContextCallback, Object) Method

Definition

Runs the specified method in the specified security context on the current thread.

public:
 static void Run(System::Security::SecurityContext ^ securityContext, System::Threading::ContextCallback ^ callback, System::Object ^ state);
public static void Run(System.Security.SecurityContext securityContext, System.Threading.ContextCallback callback, object state);
[System.Security.SecurityCritical]
public static void Run(System.Security.SecurityContext securityContext, System.Threading.ContextCallback callback, object state);
static member Run : System.Security.SecurityContext * System.Threading.ContextCallback * obj -> unit
[<System.Security.SecurityCritical>]
static member Run : System.Security.SecurityContext * System.Threading.ContextCallback * obj -> unit
Public Shared Sub Run (securityContext As SecurityContext, callback As ContextCallback, state As Object)

Parameters

securityContext
SecurityContext

The security context to set.

callback
ContextCallback

The delegate that represents the method to run in the specified security context.

state
Object

The object to pass to the callback method.

Attributes

Exceptions

securityContext is null.

-or-

securityContext was not acquired through a capture operation.

-or-

securityContext has already been used as the argument to a Run(SecurityContext, ContextCallback, Object) method call.

.NET 5+ (including .NET Core): In all cases.

Remarks

The security context for the current thread is returned to its previous state when the method call is complete.

Applies to