次の方法で共有


ListMerger.ThreeWayMerge<T,U> Method

Definition

Given a baseline and two current lists, computes the merged result. The differences between the baseline and the current lists are analyzed in terms of the following operations:

  • Add a new item to the front (index 0)
  • Remove an item from anywhere This method derives an ordered list of operations that would transform the baseline into each of the current lists, combines them, and applies them to the baseline to generate the result. The order of operations in "first" and "second" is maintained within the list but not between lists; for example, if the baseline is {0}, first is {1,0} and second is {2,0}, the result may be {1,2,0} or {2,1,0}. Both are equally valid.
public static System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<T,U>> ThreeWayMerge<T,U> (System.Collections.Generic.IReadOnlyList<System.Collections.Generic.KeyValuePair<T,U>> first, System.Collections.Generic.IReadOnlyList<System.Collections.Generic.KeyValuePair<T,U>> second, System.Collections.Generic.IReadOnlyList<System.Collections.Generic.KeyValuePair<T,U>> baseline, System.Collections.Generic.IEqualityComparer<T> keyComparer = default, System.Collections.Generic.IEqualityComparer<U> valueComparer = default, Microsoft.VisualStudio.Settings.Telemetry.ISettingsLogger logger = default);
static member ThreeWayMerge : System.Collections.Generic.IReadOnlyList<System.Collections.Generic.KeyValuePair<'T, 'U>> * System.Collections.Generic.IReadOnlyList<System.Collections.Generic.KeyValuePair<'T, 'U>> * System.Collections.Generic.IReadOnlyList<System.Collections.Generic.KeyValuePair<'T, 'U>> * System.Collections.Generic.IEqualityComparer<'T> * System.Collections.Generic.IEqualityComparer<'U> * Microsoft.VisualStudio.Settings.Telemetry.ISettingsLogger -> seq<System.Collections.Generic.KeyValuePair<'T, 'U>>
Public Shared Function ThreeWayMerge(Of T, U) (first As IReadOnlyList(Of KeyValuePair(Of T, U)), second As IReadOnlyList(Of KeyValuePair(Of T, U)), baseline As IReadOnlyList(Of KeyValuePair(Of T, U)), Optional keyComparer As IEqualityComparer(Of T) = Nothing, Optional valueComparer As IEqualityComparer(Of U) = Nothing, Optional logger As ISettingsLogger = Nothing) As IEnumerable(Of KeyValuePair(Of T, U))

Type Parameters

T
U

Parameters

baseline
IReadOnlyList<KeyValuePair<T,U>>
keyComparer
IEqualityComparer<T>
valueComparer
IEqualityComparer<U>

Returns

Exceptions

Thrown when first, second, or baseline is null.

Applies to