public T[] GetRecycledObject(int count) { if (!Enabled) { return(null); } if (RecycleBin.Count == 0 || RecycleBin.Count < count) { return(null); } T[] r = new T[count]; int i = 0; foreach (var k in RecycleBin.Keys) { r[i++] = k; if (i >= count) { break; } } for (i = 0; i < count; i++) { RecycleBin.Remove(r[i]); } return(r); }
public T GetRecycledObject() { if (!Enabled) { return(default(T)); } if (RecycleBin.Count == 0) { return(default(T)); } foreach (var k in RecycleBin.Keys) { RecycleBin.Remove(k); return(k); } return(default(T)); }