no puedo conocer la diferencia entre LinqQuery.ToList(). Distinct() y LinqQuery.Distinct(). ToList(); para mí, ambos se ven igual.por qué .ToList(). Distinct() arroja el error pero no el .Distinct(). ToList() con la consulta linq
consideran este código de ejemplo :
List<string> stringList = new List<string>();
List<string> str1 = (from item in stringList
select item).ToList().Distinct();
List<string> str2 = (from item in stringList
select item).Distinct().ToList();
str1 muestra un error como: ". No se puede convertir implícitamente el tipo 'System.Collections.Generic.IEnumerable' a 'System.Collections.Generic.List' Un explícita la conversión existe (¿falta un molde?) "
pero no hay error para str2.
Por favor, ayúdame a entender la diferencia entre estos dos. Gracias
"tiros" tiende a ser utilizado para describir un error que se produce en tiempo de ejecución (por lo general una excepción). Considerando que este es un error de tiempo de compilación. –