Add new Language Type C# Auto
It might be possible to parse the query contents looking for a Main Block or an ; separator to determine if the query is to be treated as C# Expression, C# Statements or C# Program? If so, this would have the advantage that would can highlight and execute statements that happen to be in a 'C# Program' query (rather than having to copy them to another query window).
Unless I misunderstand you, you are thinking about trying to compile the query in each mode to see which works, but I was more thinking about a simple pre-compile check to guess which mode the user wants and then to proceed as if the user had selected that mode.
For example, if I write a query which includes other classes, but I leave out the main keyword, (which is the trigger for Program mode) then I would expect this to try (and fail) to compile as if I had selected 'C# statements' mode.
If the query doesn't compile in any mode, what language should be used when presenting the errors?