//Rextester.Program.Main is the entry point for your code. Don't change it.
//Compiler version 4.0.30319.17929 for Microsoft (R) .NET Framework 4.5
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
namespace Rextester
{
public class Program
public static void Main(string[] args)
List<string> values = new List<string>() { "(1,1,1)", "(1,2,1)", "(1,4,1)", "(2,3,2)", "(2,5,2)", "(1,4,2)", "(1,2,2)", "(1,1,2)", "(2,5,1)", "(2,4,1)", "(2,9,1)" };
List<Vector3> vectors = values.Select(v => new Vector3(v)).ToList();
var result = vectors
.GroupBy(v => Tuple.Create(v.X, v.Z))
.Select(vg => vg.OrderByDescending(v => v.Y).First())
.ToList();
foreach (var val in result)
Console.Write(val.ToString() + " ");
}
Console.WriteLine();
public class Vector3
public int X {get;set;}
public int Y {get;set;}
public int Z {get;set;}
public Vector3()
(1,4,1) (2,5,2) (1,4,2) (2,9,1)