static void AddRef(ChipmunkObject obj, IntPtr ptr) { List<ChipmunkObject> list; if (!references.TryGetValue (ptr, out list)){ list = new List<ChipmunkObject> (); references.Add (ptr, list); } list.Add (obj); }
static void AddRef(ChipmunkObject obj, IntPtr ptr) { List <ChipmunkObject> list; if (!references.TryGetValue(ptr, out list)) { list = new List <ChipmunkObject> (); references.Add(ptr, list); } list.Add(obj); }
static bool RemoveRef(ChipmunkObject obj, IntPtr ptr) { List<ChipmunkObject> list; if (references.TryGetValue (ptr, out list)) { list.Remove (obj); if (list.Count == 0) { references.Remove (ptr); return true; } return false; } #if DEBUG throw new InvalidOperationException (); #endif return false; }
static bool RemoveRef(ChipmunkObject obj, IntPtr ptr) { List <ChipmunkObject> list; if (references.TryGetValue(ptr, out list)) { list.Remove(obj); if (list.Count == 0) { references.Remove(ptr); return(true); } return(false); } #if DEBUG throw new InvalidOperationException(); #endif return(false); }