C# Distinct objects

In the case, I want to remove the duplicate objects of the list.
I use the object key, UserId and Type, to distinguish them in the list.
After I distinct the objects, the count of the list becomes 2.
The numbers of the list are 2023021403 and 2023021401.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
using System;
using System.Collections.Generic;
using System.Linq;

namespace App
{
internal class Program
{
private class OrderModel
{
public int UserId { get; set; }
public int Type { get; set; }
public string Number { get; set; }
}

static void Main(string[] args)
{
var orders = new List<OrderModel>
{
new OrderModel
{
UserId = 1,
Type = 1,
Number = "2023021401"
},
new OrderModel
{
UserId = 1,
Type = 1,
Number = "2023021402"
}
,
new OrderModel
{
UserId = 1,
Type = 2,
Number = "2023021403"
}
};

var distinctList = orders
.GroupBy(x => new { x.Type, x.UserId })
.Select(x => x.FirstOrDefault())
.ToList();

foreach (var o in distinctList)
{
Console.WriteLine($"Number:{o.Number}");
Console.WriteLine($"UserId:{o.UserId}");
Console.WriteLine($"Type:{o.Type}");
Console.WriteLine("===");
}
}
}
}

Output:

1
2
3
4
5
6
7
8
Number:2023021401
UserId:1
Type:1
===
Number:2023021403
UserId:1
Type:2
===