我有一个关于LINQ查询的问题.通常,查询返回一个IEnumerable<T>类型.如果返回为空,则不确定它是否为null.我不确定如果在结果中找不到任何内容,以下ToList()是否会抛出异常或只是空?List<string>IEnumerable
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();
Run Code Online (Sandbox Code Playgroud)
我知道这是一个非常简单的问题,但我暂时没有VS可用.