score:3

Accepted answer

This should get you the idea:

new [] { 
    "010000100001", "010000100001", "010000100001", "010000100002",
    "010000100002", "010000100002", "010000200003", "010000200003",
    "020000300004", "020000300005" }
.GroupBy(s => new {
          Subject = s.Substring(0,2),
          Chapter = s.Substring(2,6),
          Book    = s.Substring(8) });

Edit See a demo live on https://ideone.com/A6RQU


Related Articles