protected void SetValue_Internal(KV dest, VAL value) { if (dest.IsComputed) { switch (onAssignmentToFunction) { case ResultOfAssigningToFunction.ThrowException: string errorMessage = "can't set " + dest.key + ", this value is computed."; if (dest.reliesOn != null) { errorMessage += " relies on: " + string.Join(", ", dest.reliesOn.ConvertAll(kv => kv.key.ToString()).ToArray()); } throw new Exception(errorMessage); case ResultOfAssigningToFunction.Ignore: return; case ResultOfAssigningToFunction.OverwriteFunction: dest.Compute = null; break; } } VAL old = dest.val; dest.SetInternal(value); onChange?.Invoke(dest._key, old, dest._val); }