[...]
And I find it a bit difficult to see how it could, because IEnumerable<>
ToList is in MS code not NHibernate code.
No, not necessarily. System.Linq.Enumerable.ToList<TSource>(this
IEnumerable<TSource> source) is MS code. But anyone can provide a
completely different extension method with the exact same signature and
use that instead.
There is no way to tell from a context-free snippet like this:
void SomeMethod<T>(IEnumerable<T> source)
{
IList<T> list = source.ToList();
}
…what the implementation of "source.ToList()" is. And even if we change
the type of the variable to "List<T>" instead of "IList<T>", at most we
can say (according to what you've written) is that it's not NHibernate
LINQ's implementation. But it still could be any other implementation,
not necessarily Microsoft's.
The only way to know the actual implementation is to see the entire
source file, so we can know what "using" directives are present
controlling which extensions methods are being used.