Selecting from multiple implementations of an interface using #if

Hello:   I thought I had this working but for some reason... it is no longer...
I am using Visual Studio Pro 2013 with Resharper Ultimate 9.2, creating a .NET4.5 Console Application using C#.

I have two files, each implementing the same IGameInterface interface.  Each file uses a different namespace: GameAnamespace and GameBnamespace.     The IGameInterface implements function: Functiona.
Both are referenced by the project.

At the top of GameService.cs, I have:

#if (USE_STUB)

     using GameAnamespace;      // Stub for testing and code reviews.
#else
     using GameBnamespace;       
#endif



The "USE_STUB" is defined in the build properties and seems to work because the proper "using" statement is greyed out.

Later down in my code, I have a statement such as:

int A = FunctionA();

I would expect that the #if at the start would determine which implementation is being used.
But Reshaper is giving me an error stating that "GameAnamespace.FunctionA (multiple choice...)?" and wants me to qualify the call with a specific namespace.

What am I missing????   Any help would be appreciated.

Thanks
-Ed

Please sign in to leave a comment.