protected void RemoveInstanceCore <TInstance>(string extName) { var cell = StateStack.FirstOrDefault(p => p.InstanceType == typeof(TInstance) && p.ExtName == extName); if (cell != null) { StateStack.Remove(cell); } }
protected void SetInstanceCore <TInstance>(TInstance instance, string extName) { var cell = StateStack.FirstOrDefault(p => p.InstanceType == typeof(TInstance) && p.ExtName == extName); if (cell != null) { cell.Instance = instance; } else { StateStack.Add(new InstanceCell { Instance = instance, ExtName = extName, InstanceType = typeof(TInstance) }); } }