-
-
Notifications
You must be signed in to change notification settings - Fork 245
Expand file tree
/
Copy pathRequest_OrderBy_StringComparer.cs
More file actions
42 lines (39 loc) · 1.5 KB
/
Request_OrderBy_StringComparer.cs
File metadata and controls
42 lines (39 loc) · 1.5 KB
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
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Linq.Dynamic.Core;
using System.Text;
namespace Z.Dynamic.Core.Lab
{
class Request_OrderBy_StringComparer
{
public class Customer
{
public string City { get; set; }
public List<Order> Orders { get; set; }
public string CompanyName { get; set; }
public string Phone { get; set; }
}
public class Order
{
}
public static void Execute()
{
List<Customer> customers = new List<Customer>() { new Customer() { CompanyName = "Ååå"} ,
new Customer() { CompanyName = "Bbb" } ,
new Customer() { CompanyName = "Ååå" } ,
new Customer() { CompanyName = "Bbb" } ,
new Customer() { CompanyName = "Aaa" },
new Customer() { CompanyName = "Aaa" },
};
CultureInfo culture = new CultureInfo("nb-NO");
var test1 = customers.AsQueryable().OrderBy(x => x.CompanyName, StringComparer.Create(culture, true)).ToList();
var test2 = customers.AsQueryable().OrderBy(x => x.CompanyName).ToList();
var test3 = customers.AsQueryable()
.OrderBy("City").ThenBy("CompanyName", StringComparer.Create(culture, true)).ToDynamicList();
var test4 = customers.AsQueryable()
.OrderBy("CompanyName", StringComparer.Create(culture, true)).ToDynamicList();
}
}
}