This following code example is borrowed from MSDN here. I am not getting query.CopyToDataTable() available in my code. (see the commented line in my following code).
This issue for me was caused by using Dotnet Core 2.0, which appears to have no way to turn an IEnumerable back into a DataTable after it's converted.
IEnumerable
DataTable
Just adding this for anyone that comes across this question with the same issue.