Ho una domanda sulla query LINQ. Normalmente una query restituisce un tipo IEnumerable. Se il reso è vuoto, non è sicuro se è nullo o meno. Non sono sicuro che la seguente ToList() genererà un'eccezione o solo una stringa vuota < > se non viene trovato nulla nel risultato IEnumerable?Cosa restituisce LINQ quando i risultati sono vuoti
List<string> list = {"a"};
// is the result null or something else?
IEnumerable<string> ilist = from x in list where x == "ABC" select x;
// Or directly to a list, exception thrown?
List<string> list1 = (from x in list where x == "ABC" select x).ToList();
So che è una domanda molto semplice, ma non ho VS disponibile per il momento.
Immagino che il risultato sia Enumerable.Empty? –