SHOW:
|
|
- or go back to the newest paste.
1 | [<AbstractClass>] | |
2 | type A () = | |
3 | member x.Guid with get, set | |
4 | member x.ExternalId with get, set | |
5 | ||
6 | override x.Equals(yobj) = | |
7 | match yobj with | |
8 | | :? A as y -> | |
9 | if (x.Guid = Guid.Empty || y.Guid = Guid.Empty) then | |
10 | // Lets look for ExternalId | |
11 | x.ExternalId = y.ExternalId | |
12 | else | |
13 | x.Guid = y.Guid | |
14 | | _ -> false | |
15 | ||
16 | type B () = | |
17 | inherit A () | |
18 | ||
19 | override x.Equals(yobj) = | |
20 | match yobj with | |
21 | | :? B as y -> | |
22 | if (x.Guid = Guid.Empty || y.Guid = Guid.Empty) then | |
23 | // Lets look for ExternalId | |
24 | x.ExternalId = y.ExternalId | |
25 | else | |
26 | x.Guid = y.Guid | |
27 | | _ -> false | |
28 | ||
29 | type C () = | |
30 | inherit A () | |
31 | ||
32 | override x.Equals(yobj) = | |
33 | match yobj with | |
34 | | :? C as y -> | |
35 | if (x.Guid = Guid.Empty || y.Guid = Guid.Empty) then | |
36 | // Lets look for ExternalId | |
37 | x.ExternalId = y.ExternalId | |
38 | else | |
39 | x.Guid = y.Guid | |
40 | | _ -> false |