First of all, you can check the official document about Conditional compilation. The #if <Platform>
is preprocessor directive.
The C# compiler compiles the code between the #if directive and #endif directive only if the specified symbol is defined, or not defined when the ! not operator is used.
And the official document about Dependency injection in Maui doesn't mention the platform code. The dependency injection almost uses in the maui share library not platform part.