forked from zzzprojects/System.Linq.Dynamic.Core
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
41 lines (37 loc) · 1.84 KB
/
Program.cs
File metadata and controls
41 lines (37 loc) · 1.84 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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Dynamic.Core;
using Newtonsoft.Json;
namespace Z.Dynamic.Core.Lab
{
class Program
{
static void Main(string[] args)
{
var data = new List<object> {
new { ItemCode = "AAAA", Flag = true, SoNo="aaa",JobNo="JNO01" } ,
new { ItemCode = "AAAA", Flag = true, SoNo="aaa",JobNo="JNO02" } ,
new { ItemCode = "AAAA", Flag = false, SoNo="aaa",JobNo="JNO03" } ,
new { ItemCode = "BBBB", Flag = true, SoNo="bbb",JobNo="JNO04" },
new { ItemCode = "BBBB", Flag = true, SoNo="bbb",JobNo="JNO05" } ,
new { ItemCode = "BBBB", Flag = true, SoNo="ccc",JobNo="JNO06" } ,
};
var jsonString = JsonConvert.SerializeObject(data);
var list = JsonConvert.DeserializeObject<List<Dictionary<string, object>>>(jsonString);
var groupList = list.AsQueryable().GroupBy("new (ItemCode, Flag)").ToDynamicList();
//var data = new List<object> {
// new { ItemCode = "AAAA", Flag = true, SoNo="aaa",JobNo="JNO01" } ,
// new { ItemCode = "AAAA", Flag = true, SoNo="aaa",JobNo="JNO02" } ,
// new { ItemCode = "AAAA", Flag = false, SoNo="aaa",JobNo="JNO03" } ,
// new { ItemCode = "BBBB", Flag = true, SoNo="bbb",JobNo="JNO04" },
// new { ItemCode = "BBBB", Flag = true, SoNo="bbb",JobNo="JNO05" } ,
// new { ItemCode = "BBBB", Flag = true, SoNo="ccc",JobNo="JNO06" } ,
//};
//var jsonString = JsonConvert.SerializeObject(data);
//var list = JsonConvert.DeserializeObject<List<object>>(jsonString).ToList();
//var groupList = list.Select("new (ItemCode, Flag)");
Request_Dictionary.Execute();
}
}
}