Tengo dos listas de listas que necesito combinar en la tercera lista y eliminar valores duplicados de esas listas
Un poco difícil de explicar, así que permítanme mostrar un ejemplo de cómo se ve el código y lo que quiero como resultado, en la muestra utilizo el tipo int no la clase ResultAnalysisFileSql.
first_list = [1, 12, 12, 5]
second_list = [12, 5, 7, 9, 1]
El resultado de combinar las dos listas debe dar como resultado esta lista: result_list = [1, 12, 5, 7, 9]
Notará que el resultado tiene la primera lista, incluidos sus dos valores "12", y en second_list tiene un valor adicional de 12, 1 y 5.
Clase ResultAnalysisFileSql
[Serializable]
    public partial class ResultAnalysisFileSql
    {
        public string FileSql { get; set; }
        public string PathFileSql { get; set; }
        public List<ErrorAnalysisSql> Errors { get; set; }
        public List<WarningAnalysisSql> Warnings{ get; set; }
        public ResultAnalysisFileSql()
        {
        }
        public ResultAnalysisFileSql(string fileSql)
        {
            if (string.IsNullOrEmpty(fileSql)
                || fileSql.Trim().Length == 0)
            {
                throw new ArgumentNullException("fileSql", "fileSql is null");
            }
            if (!fileSql.EndsWith(Utility.ExtensionFicherosErrorYWarning))
            {
                throw new ArgumentOutOfRangeException("fileSql", "Ruta de fichero Sql no tiene extensión " + Utility.ExtensionFicherosErrorYWarning);
            }
            PathFileSql = fileSql;
            FileSql = ObtenerNombreFicheroSql(fileSql);
            Errors = new List<ErrorAnalysisSql>();
            Warnings= new List<WarningAnalysisSql>();
        }
        private string ObtenerNombreFicheroSql(string fileSql)
        {
            var f = Path.GetFileName(fileSql);
            return f.Substring(0, f.IndexOf(Utility.ExtensionFicherosErrorYWarning));
        }
        public override bool Equals(object obj)
        {
            if (obj == null)
                return false;
            if (!(obj is ResultAnalysisFileSql))
                return false;
            var t = obj as ResultAnalysisFileSql;
            return t.FileSql== this.FileSql
                && t.PathFileSql == this.PathFileSql
                && t.Errors.Count == this.Errors.Count
                && t.Warnings.Count == this.Warnings.Count;
        }
    }
¿Algún código de muestra para combinar y eliminar duplicados?
fuente

cannot be inferred from the usageerror.por qué no simplemente, por ejemplo
oh ... según msdn puedes omitir el
.Distinct()fuente
La unión no tiene un buen desempeño: este artículo describe cómo compararlos
Listas y combinación de LINQ: 4820 ms Fusión de
diccionario: 16
ms HashSet y IEqualityComparer: 20 ms
LINQ Union e IEqualityComparer: 24 ms
fuente
Unionobtiene un código más limpio y más legible. Pasar tiempo para hiper-optimizar el código cuando no es lento puede incurrir en una penalización de mantenimiento en el futuro.Utilice la unión de Linq:
fuente
fuente