どうも、ソースのコピペ量が増えると色々と面倒で、綺麗なHTMLにしたいし、いれてみた。
Visual Studio 2015 で使えまする。
これで、
こういうメニューがでてくるので、あとは、説明なくても大丈夫だよねw
サンプルソースは一つ前の記事の、完全動作コード。
Module Module1
Sub Main()
Dim samples As New List(Of SampleRecord)
Dim rnd As New Random
Dim KeysCount = rnd.Next(1, 23)
Console.WriteLine("{0} 件キー", KeysCount)
For x As Integer = 1 To KeysCount
For f As Integer = 1 To rnd.Next(1, 55)
samples.Add(New SampleRecord With {
.Key1 = x.ToString("KeyA-000"),
.Key2 = x.ToString("KeyB-000"),
.Key3 = x.ToString("KeyC-000"),
.Data1 = f.ToString("DataA-00"),
.Data2 = f.ToString("DataB-00"),
.Data3 = f.ToString("DataC-00")
})
Next
Next
Dim c = From x As SampleRecord In samples
Group x By x.Key1, x.Key2, x.Key3
Into Datas = Group
Select New Hoge With {
.Key1 = Key1,
.Key2 = Key2,
.Key3 = Key3,
.Datas = Datas.Select(Function(f)
Return New DetailData With {
.Data1 = f.Data1,
.Data2 = f.Data2,
.Data3 = f.Data3
}
End Function).ToList
}
c.ToList.ForEach(Function(x)
Console.WriteLine("{0}-{1}-{2}-{3}", x.Key1, x.Key2, x.Key3, x.Datas.Count)
End Function)
Console.ReadKey()
End Sub
End Module
Public Class SampleRecord
Property Key1 As String
Property Key2 As String
Property Key3 As String
Property Data1 As String
Property Data2 As String
Property Data3 As String
End Class
Public Class DetailData
Property Data1 As String
Property Data2 As String
Property Data3 As String
End Class
Public Class Hoge
Property Key1 As String
Property Key2 As String
Property Key3 As String
Property Datas As List(Of DetailData)
End Class
ふむ、やれそうだ(謎)