public void AddTexture(TreeTexInfo tex) { lock (Locker) { if (!Textures.Contains<TreeTexInfo>(tex)) // Enable comparison by IEquatable interface Textures.Add(tex); else { var existing = Textures[Textures.IndexOf(tex)]; existing.Update(tex); tex.GenerateThumbnail = null; // clear generation code - frees up many large objects for GC. return; } } // Generate thumbnail if new texture tex.GenerateThumbnail(); tex.GenerateThumbnail = null; // clear generation code - frees up many large objects for GC. }