SafeHandle::SetHandleAsInvalid Method ()

 
System_CAPS_noteNote

The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

Marks a handle as no longer used.

Namespace:   System.Runtime.InteropServices
Assembly:  mscorlib (in mscorlib.dll)

public:
[SecurityCriticalAttribute]
void SetHandleAsInvalid()

Call the SetHandleAsInvalid method only when you know that your handle no longer references a resource. Doing so does not change the value of the handle field; it only marks the handle as closed. The handle might then contain a potentially stale value. The effect of this call is that no attempt is made to free the resources.

As with the SetHandle method, use SetHandleAsInvalid only if you need to support a pre-existing handle.

SecurityPermission

for permission to call unmanaged code. Security action: LinkDemand. Associated enumeration: SecurityPermissionFlag::UnmanagedCode

Universal Windows Platform
Available since 8
.NET Framework
Available since 2.0
Portable Class Library
Supported in: portable .NET platforms
Silverlight
Available since 2.0
Windows Phone Silverlight
Available since 7.0
Windows Phone
Available since 8.1
Return to top
Show: