System.Runtime.MemoryFailPoint.Dispose C# (CSharp) Method

Dispose() public method

public Dispose ( ) : void
return void
        public void Dispose()
        {
            Dispose(true);
            GC.SuppressFinalize(this);
        }

Same methods

MemoryFailPoint::Dispose ( bool disposing ) : void

Usage Example

 public static bool EnsureMemoryAvailability(int expectedSizeMegaBytes)
 {
     if (expectedSizeMegaBytes < 0)
     {
         throw new ArgumentException("Param expectedSizeBytes should be positive", "expectedSizeMegaBytes");
     }
     bool available = true;
     MemoryFailPoint p = null;
     try
     {
          p = new MemoryFailPoint(expectedSizeMegaBytes);
     }
     catch(InsufficientMemoryException)
     {
         available = false;
     }
     finally
     {
         if(p != null)
         {
             try { p.Dispose(); }
             catch(Exception)
             {
                 // ignored
             }
         }
     }
     return available;
 }
All Usage Examples Of System.Runtime.MemoryFailPoint::Dispose