public void Release(string key) { lock (_shaderPrograms) { CachedShaderProgram cachedShaderProgram = _shaderPrograms[key]; if (--cachedShaderProgram.ReferenceCount == 0) { _shaderPrograms.Remove(key); cachedShaderProgram.ShaderProgram.Dispose(); } } }