blob: 8bd67c9a339d1250a035ecaeec4b15793ead73df (
plain)
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
|
/***************************************************************************************************
Copyright (C) 2025 The Qt Company Ltd.
SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
***************************************************************************************************/
namespace UserViewLib
{
public class UserComparer : IComparer<User>
{
public static UserComparer ByLastName { get; } = new()
{
Compare = (x, y) => string.Compare(x.Name.Last, y.Name.Last, true)
};
public static UserComparer ByFirstName { get; } = new()
{
Compare = (x, y) => string.Compare(x.Name.First, y.Name.First, true)
};
private UserComparer() { }
private Func<User, User, int> Compare { get; set; }
int IComparer<User>.Compare(User x, User y) => Compare(x, y);
}
}
|