You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Using generic typing, you can diff all sorts of types. You can also customize which values are considered equal by specifying a third constructor parameter (IEqualityComparer<T>).
19
20
20
-
There are two methods to access the results: `GetResult()` and `GetEditScript()`.
21
-
22
-
### GetResult()
23
-
`GetResult()` returns the resulting diff as a sequence of tuples that represent lines. In this case, the return value would look like this:
24
-
| ResultType | AItem | BItem |
25
-
|------------|-------|-------|
26
-
| A | a ||
27
-
| B || c |
28
-
| Both | b | b |
29
-
| A | c ||
30
-
| Both | a | a |
31
-
| Both | b | b |
32
-
| A | b ||
33
-
| Both | a | a |
34
-
| B || c |
35
-
36
-
This is similar to how the result would be displayed in a visual comparison application. The AItem and BItem columns contain sequence A and B, respectively. The ResultType column shows whether a line contains a value from sequence A, B, or from both. You can see which values were matched with each other.
21
+
There are two methods to access the results: `GetEditScript()` and `GetResult()`.
37
22
38
23
### GetEditScript()
39
24
`GetEditScript()` returns a sequence of edit instructions. You can understand these as instructions to follow to transform sequence A to sequence B. Every instruction contains four integers, a starting line number in A and B and the number of lines to add or remove. In this case, the return value would look like this:
@@ -65,3 +50,36 @@ To better understand this, let's follow these instructions:
65
50
*(This adds the last "c")*
66
51
67
52
Following these instructions, `abcabba` is transformed to `cbabac`.
53
+
54
+
55
+
### GetResult()
56
+
`GetResult()` returns the resulting diff as a sequence of tuples that represent lines. In this case, the return value would look like this:
57
+
| ResultType | AItem | BItem |
58
+
|------------|-------|-------|
59
+
| A | a ||
60
+
| B || c |
61
+
| Both | b | b |
62
+
| A | c ||
63
+
| Both | a | a |
64
+
| Both | b | b |
65
+
| A | b ||
66
+
| Both | a | a |
67
+
| B || c |
68
+
69
+
This is similar to how the result would be displayed in a visual comparison application. The AItem and BItem columns contain sequence A and B, respectively. The ResultType column shows whether a line contains a value from sequence A, B, or from both. You can see which values were matched with each other.
70
+
71
+
### GetResult(ResultOrder)
72
+
You can specify the order in which you want unmatched lines to appear by using the `GetResult(ResultOrder)` overload. To visualize this, we need to use a new example.
73
+
```
74
+
A: a b c
75
+
B: x y
76
+
```
77
+
78
+
The following table shows how the result would be returned when specifying the different ResultOrder values AABB, BBAA, ABAB and BABA:
0 commit comments