示例#1
0
 private void Dispose(bool disposing)
 {
     if (handle.ToInt32() != 0)
     {
         APIFunctionSimulator.ReleaseResource(handle);
         handle = (IntPtr)0;
     }
     if (disposing)
     {
         bigArray = null;
     }
 }
示例#2
0
        static void UseUnmanagedResource()
        {
            IntPtr handle = APIFunctionSimulator.GetResource();

            try
            {
                string result = APIFunctionSimulator.UseResource(handle);
                Console.WriteLine("In EntryPoint.UseUnmanagedResource, result is :" + result);
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception in UseUnmanagedResource: " + e.Message);
            }
            finally
            {
                if (handle.ToInt32() != 0)
                {
                    APIFunctionSimulator.ReleaseResource(handle);
                }
            }
        }