diff --git a/collections-lists/HowToCompareTwoListsThroughOneProperty/Benchmark/Benchmark.csproj b/collections-lists/HowToCompareTwoListsThroughOneProperty/Benchmark/Benchmark.csproj
index 3d8903a8bd..6ddf9fa0e2 100644
--- a/collections-lists/HowToCompareTwoListsThroughOneProperty/Benchmark/Benchmark.csproj
+++ b/collections-lists/HowToCompareTwoListsThroughOneProperty/Benchmark/Benchmark.csproj
@@ -2,7 +2,7 @@
Exe
- net8.0
+ net10.0
enable
enable
diff --git a/collections-lists/HowToCompareTwoListsThroughOneProperty/HowToCompareTwoLists.Tests/HowToCompareTwoLists.Tests.csproj b/collections-lists/HowToCompareTwoListsThroughOneProperty/HowToCompareTwoLists.Tests/HowToCompareTwoLists.Tests.csproj
index b86b664228..95317a21b8 100644
--- a/collections-lists/HowToCompareTwoListsThroughOneProperty/HowToCompareTwoLists.Tests/HowToCompareTwoLists.Tests.csproj
+++ b/collections-lists/HowToCompareTwoListsThroughOneProperty/HowToCompareTwoLists.Tests/HowToCompareTwoLists.Tests.csproj
@@ -1,7 +1,7 @@
- net8.0
+ net10.0
enable
enable
diff --git a/collections-lists/HowToCompareTwoListsThroughOneProperty/HowToCompareTwoLists.Tests/UnitTests.cs b/collections-lists/HowToCompareTwoListsThroughOneProperty/HowToCompareTwoLists.Tests/UnitTests.cs
index 05e7f1bb00..b55fb88f0f 100644
--- a/collections-lists/HowToCompareTwoListsThroughOneProperty/HowToCompareTwoLists.Tests/UnitTests.cs
+++ b/collections-lists/HowToCompareTwoListsThroughOneProperty/HowToCompareTwoLists.Tests/UnitTests.cs
@@ -250,4 +250,35 @@ public void GivenJoinListMethod_WhenNoCustomers_ThenReturnEmptyList()
Assert.That(result, Is.Not.Null);
Assert.That(result, Has.Count.EqualTo(0));
}
-}
\ No newline at end of file
+
+ [Test]
+ public void GivenExceptByMethod_WhenThreeCustomersWithTwoOrders_ThenReturnCustomerWithoutOrders()
+ {
+ var result = ListCompareMethods.ExceptByMethod(_threeCustomers, _twoOrders);
+
+ Assert.That(result, Is.Not.Null);
+ Assert.That(result, Has.Count.EqualTo(1));
+
+ CollectionAssert.Contains(result, _threeCustomers[2]);
+ CollectionAssert.DoesNotContain(result, _threeCustomers[0]);
+ CollectionAssert.DoesNotContain(result, _threeCustomers[1]);
+ }
+
+ [Test]
+ public void GivenExceptByMethod_WhenThreeCustomersWithThreeOrders_ThenReturnEmptyList()
+ {
+ var result = ListCompareMethods.ExceptByMethod(_threeCustomers, _threeOrders);
+
+ Assert.That(result, Is.Not.Null);
+ Assert.That(result, Has.Count.EqualTo(0));
+ }
+
+ [Test]
+ public void GivenExceptByMethod_WhenNoOrders_ThenReturnAllCustomers()
+ {
+ var result = ListCompareMethods.ExceptByMethod(_threeCustomers, []);
+
+ Assert.That(result, Is.Not.Null);
+ Assert.That(result, Has.Count.EqualTo(3));
+ }
+}
diff --git a/collections-lists/HowToCompareTwoListsThroughOneProperty/HowToCompareTwoListsThroughOneProperty/HowToCompareTwoListsThroughOneProperty.csproj b/collections-lists/HowToCompareTwoListsThroughOneProperty/HowToCompareTwoListsThroughOneProperty/HowToCompareTwoListsThroughOneProperty.csproj
index 2150e3797b..ed9781c223 100644
--- a/collections-lists/HowToCompareTwoListsThroughOneProperty/HowToCompareTwoListsThroughOneProperty/HowToCompareTwoListsThroughOneProperty.csproj
+++ b/collections-lists/HowToCompareTwoListsThroughOneProperty/HowToCompareTwoListsThroughOneProperty/HowToCompareTwoListsThroughOneProperty.csproj
@@ -2,7 +2,7 @@
Exe
- net8.0
+ net10.0
enable
enable
diff --git a/collections-lists/HowToCompareTwoListsThroughOneProperty/HowToCompareTwoListsThroughOneProperty/Methods/ListCompareMethods.cs b/collections-lists/HowToCompareTwoListsThroughOneProperty/HowToCompareTwoListsThroughOneProperty/Methods/ListCompareMethods.cs
index 1a157d2fb3..d318a62fdc 100644
--- a/collections-lists/HowToCompareTwoListsThroughOneProperty/HowToCompareTwoListsThroughOneProperty/Methods/ListCompareMethods.cs
+++ b/collections-lists/HowToCompareTwoListsThroughOneProperty/HowToCompareTwoListsThroughOneProperty/Methods/ListCompareMethods.cs
@@ -53,4 +53,11 @@ public static List JoinListMethod(List customerList, List customer
).Distinct().ToList();
}
+
+ public static List ExceptByMethod(List customerList, List orderList)
+ {
+ var orderedIds = orderList.Select(o => o.CustomerId);
+
+ return customerList.ExceptBy(orderedIds, c => c.Id).ToList();
+ }
}
diff --git a/collections-lists/HowToCompareTwoListsThroughOneProperty/HowToCompareTwoListsThroughOneProperty/Program.cs b/collections-lists/HowToCompareTwoListsThroughOneProperty/HowToCompareTwoListsThroughOneProperty/Program.cs
index c190511f32..7e91890ee7 100644
--- a/collections-lists/HowToCompareTwoListsThroughOneProperty/HowToCompareTwoListsThroughOneProperty/Program.cs
+++ b/collections-lists/HowToCompareTwoListsThroughOneProperty/HowToCompareTwoListsThroughOneProperty/Program.cs
@@ -28,4 +28,7 @@
Console.WriteLine(string.Join(',', customerWithOrdersD.Select(i => i.Firstname)));
var customerWithOrdersE = ListCompareMethods.JoinListMethod(customers, orders);
-Console.WriteLine(string.Join(',', customerWithOrdersE.Select(i => i.Firstname)));
\ No newline at end of file
+Console.WriteLine(string.Join(',', customerWithOrdersE.Select(i => i.Firstname)));
+
+var customersWithoutOrders = ListCompareMethods.ExceptByMethod(customers, orders);
+Console.WriteLine(string.Join(',', customersWithoutOrders.Select(i => i.Firstname)));