using System.Collections.Generic;
public static void Main()
List<tmpDataObj> testData = new List<tmpDataObj>();
testData.Add(new tmpDataObj("12345","2022/11/01"));
testData.Add(new tmpDataObj("22441","2022/12/01"));
testData.Add(new tmpDataObj("22441","2022/11/30"));
testData.Add(new tmpDataObj("12345","2022/11/01"));
var workData =( from r in testData
group r by new {r.VDNO,r.VDSNAME, DTM= r.DTM.Date.ToString("yyyy/MM") } into G
Console.WriteLine("Fake Data");
Console.WriteLine(JsonConvert.SerializeObject(workData, Formatting.Indented));
Console.WriteLine("".PadRight(99,'='));
Console.WriteLine("Generate sequence");
var workDataWithSequence = workData.Select((data,index)=>new {
SQENO = $"{DateTime.Now:yyyyMM}{index+1:00}"
Console.WriteLine(JsonConvert.SerializeObject(workDataWithSequence, Formatting.Indented));
public tmpDataObj(string VDNO,string DT)
this.VDSNAME = $"{VDNO}_NAME";
this.DTM = DateTime.Parse(DT);
public DateTime DTM{get;set;}
public string VDNO{get;set;}
public string VDSNAME {get;set;}