view Implab/Safe.cs @ 6:dfa21d507bc5

*refactoring: Promise.Then now returns a new chained promise *fixed bug with animations when multiple events fired simultaneously
author cin
date Mon, 21 Oct 2013 02:34:31 +0400
parents aa367305156b
children dafaadca5b9f
line wrap: on
line source

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Implab
{
    public static class Safe
    {
        public static void Dispose<T>(ref T obj) where T : class
        {
            var disp = obj as IDisposable;
            if (disp != null)
            {
                disp.Dispose();
                obj = default(T);
            }
        }
    }
}