Questo articolo è stato tradotto automaticamente. Per visualizzare l'articolo in inglese, selezionare la casella di controllo Inglese. È possibile anche visualizzare il testo inglese in una finestra popup posizionando il puntatore del mouse sopra il testo.
Traduzione
Inglese

Metodo CriticalHandle.Dispose ()

 

Data di pubblicazione: ottobre 2016

Rilascia tutte le risorse usate da CriticalHandle.

Spazio dei nomi:   System.Runtime.InteropServices
Assembly:  mscorlib (in mscorlib.dll)

public void Dispose()

Calling the M:System.Runtime.InteropServices.CriticalHandle.Close or M:System.Runtime.InteropServices.CriticalHandle.Dispose method allows the resources to be freed. Unlike the T:System.Runtime.InteropServices.SafeHandle class, this will always happen immediately since there is no reference count to indicate that other threads are using this handle. Therefore, you must employ a synchronization mechanism to ensure it is safe to call the M:System.Runtime.InteropServices.CriticalHandle.Dispose method. Although most classes that use the T:System.Runtime.InteropServices.CriticalHandle class do not need to provide a finalizer, this is sometimes necessary (for example, to flush out file buffers or to write some data back into memory). In this case, the class can provide a finalizer that is guaranteed to run before the T:System.Runtime.InteropServices.CriticalHandle critical finalizer runs.

Call the M:System.Runtime.InteropServices.CriticalHandle.Close or M:System.Runtime.InteropServices.CriticalHandle.Dispose method when you are finished using the T:System.Runtime.InteropServices.CriticalHandle object. The M:System.Runtime.InteropServices.CriticalHandle.Close method leaves the T:System.Runtime.InteropServices.CriticalHandle object in an unusable state.

Note   Always call the Close or Dispose method before you release your last reference to the CriticalHandle object. Otherwise, the resources it is using will not be freed until the garbage collector calls the CriticalHandle object's Finalize method.

Universal Windows Platform
Disponibile da 8
.NET Framework
Disponibile da 2.0
Libreria di classi portabile
Supportato in: piattaforme .NET portabili
Silverlight
Disponibile da 2.0
Windows Phone Silverlight
Disponibile da 8.0
Windows Phone
Disponibile da 8.1
Torna all'inizio
Mostra: