Make code .NET 3.5 compatible

Use compile directives to ensure smooth NuGet package generation.

'IReturnsExtensions' was using 'System.Threading.Tasks' namespace, so
compile directives were also added to it.