I have object:
var obj = new FileList
{
   FileInfo = new List<FileDiff>()
    {
      new ()
      {
         Name = "test1",
         Included = new Diff<int> {Added = new HashSet<int> {1, 2}},
         Excluded = new Diff<int> {Added = new HashSet<int> {1, 2}},
         Existing = new Diff<int> {Added = new HashSet<int> {1, 2, 3}}
  },
    new ()
     {
        Name = "test1",
        Included = new Diff<int> {Added = new HashSet<int> {3, 4, 5}},
        Excluded = new Diff<int> {Added = new HashSet<int> {11, 222}},
        Existing = new Diff<int> {Added = new HashSet<int>()}}
    },
   new ()
    {
       Name = "equal to test1",
       Included = new Diff<int> {Added = new HashSet<int> {1, 2}},
       Excluded = new Diff<int> {Added = new HashSet<int> {1, 2}},
       Existing = new Diff<int> {Added = new HashSet<int> {1, 2, 3}}
     },
   }
};
I want to transform this data to new model where name is not string but string[] and Included, Excluded and Existing are same for these string names:
var obj = new FileListV2
 {
   FileInfo = new List<FileDiff2>()
   {
    new ()
      {
        Names = new string[] {"test1", "equal to test1"},
        Included = new Diff<int> {Added = new HashSet<int> {1, 2}},
        Excluded = new Diff<int> {Added = new HashSet<int> {1, 2}},
        Existing = new Diff<int> {Added = new HashSet<int> {1, 2, 3}}
     },
    new ()
     {
       Names = new string[] {"test1"},
       Included = new Diff<int> {Added = new HashSet<int> {3, 4, 5}},
       Excluded = new Diff<int> {Added = new HashSet<int> {11, 222}},
       Existing = new Diff<int> {Added = new HashSet<int>()}}
     }
    }
};
I tried the following:
var obj2 = obj.FileList
    .GroupBy(f => new
    {
        f.Included,
        f.Excluded,
        f.Existing,
    })
    .Select(g => new FileListV2
    {
        Names = g.Select(f => f.Name).ToArray(),
        Included = g.Key.Included,
        Excluded = g.Key.Excluded,
        Existing = g.Key.Existing,
    });
However my values are not created I want them to. How should I compare those objects?
 
    