How to combine elements with same name in a list ?

Hello,
List 1
Element 0 : a, 1, 1.5, abc
Element 1 : a , 2, 3.5, bcs

How can i combine those elements into a new list with single element only if same name,

Expected output :

List 2 :
Element 0 : a, 3, 5, abcbcs

Please help.

This should really be in the scripting subforum.

But basic steps:

  • Ready new list
  • Add each element from existing list, checking a match doesn’t exist in the list
  • If a match exist, combine them in some manner with the match, otherwise add the element

You’re going to have to introduce the manner in which these elements are combined yourself.

See this example:

Enumerable.Join Method (System.Linq) | Microsoft Learn)-system-collections-generic-ienumerable((-1))-system-func((-0-2))-system-func((-1-2))-system-func((-0-1-3)))

Is this your homework?

definitely not.

Thread locked. Duplicate post to this: C# Unity3D : How to combine 2 elements of a list into Single elememnt.