both for now

This commit is contained in:
mischa 2024-10-14 12:42:10 +02:00 committed by mischa
parent b57984ab59
commit 2bf70f3bc9

View File

@ -33,9 +33,7 @@ public enum Operation : byte
/// <para>For OP_SET and OP_REMOVE, T is the OLD value of the entry.</para>
/// <para>For OP_CLEAR, T is default.</para>
/// </summary>
// DEPRECATED 2024-10-14
// TODO deprecate in favor of explicit Callback, later rename Callback to OnChange for consistency with other SyncCollections.
[Obsolete("SyncList.OnChange(op, index, item) is obsolete. Use SyncList.Callback(op, index, oldItem, newItem) instead.")]
public Action<Operation, int, T> OnChange;
/// <summary>
@ -121,37 +119,27 @@ void AddOperation(Operation op, int itemIndex, T oldItem, T newItem, bool checkA
{
case Operation.OP_ADD:
OnAdd?.Invoke(itemIndex);
#pragma warning disable CS0618
OnChange?.Invoke(op, itemIndex, newItem);
#pragma warning restore CS0618
Callback?.Invoke(op, itemIndex, oldItem, newItem);
break;
case Operation.OP_INSERT:
OnInsert?.Invoke(itemIndex);
#pragma warning disable CS0618
OnChange?.Invoke(op, itemIndex, newItem);
#pragma warning restore CS0618
Callback?.Invoke(op, itemIndex, oldItem, newItem);
break;
case Operation.OP_SET:
OnSet?.Invoke(itemIndex, oldItem);
#pragma warning disable CS0618
OnChange?.Invoke(op, itemIndex, oldItem);
#pragma warning restore CS0618
Callback?.Invoke(op, itemIndex, oldItem, newItem);
break;
case Operation.OP_REMOVEAT:
OnRemove?.Invoke(itemIndex, oldItem);
#pragma warning disable CS0618
OnChange?.Invoke(op, itemIndex, oldItem);
#pragma warning restore CS0618
Callback?.Invoke(op, itemIndex, oldItem, newItem);
break;
case Operation.OP_CLEAR:
OnClear?.Invoke();
#pragma warning disable CS0618
OnChange?.Invoke(op, itemIndex, default);
#pragma warning restore CS0618
Callback?.Invoke(op, itemIndex, default, default);
break;
}