using System.Collections.Generic;
List<CustomFormat> l1 = new List<CustomFormat>();
l1.Add(new CustomFormat("#",1));
l1.Add(new CustomFormat("##",1));
l1.Add(new CustomFormat("###",1));
l1.Add(new CustomFormat("####",1));
List<CustomFormat> l2 = new List<CustomFormat>();
l2.Add(new CustomFormat("#",1));
l2.Add(new CustomFormat("##",1));
l2.Add(new CustomFormat("###",1));
l2.Add(new CustomFormat("####",1));
l2.Add(new CustomFormat("## ###.0",1));
var l4 = l1.Union(l2, new CustomFormat()).ToList();
Console.WriteLine(l3.Mask + " " + l3.Type);
public class CustomFormat : IEqualityComparer<CustomFormat>
public CustomFormat(string c_maskin, int c_type)
public bool Equals(CustomFormat x, CustomFormat y)
if (ReferenceEquals(x, y)) return true;
return x != null && y != null && x.Mask.Equals(y.Mask) && x.Type.Equals(y.Type);
public int GetHashCode(CustomFormat obj)
int hashProductName = obj.Mask == null ? 0 : obj.Mask.GetHashCode();
int hashProductCode = obj.Type.GetHashCode();
return hashProductName ^ hashProductCode;