Resolving extension methods/LINQ ambiguity

This is probably one of those rare cases where it makes sense to use an extern alias.

In the properties page for the reference to System.Core (i.e. under References, select System.Core, right-click and select “Properties”), change the “Aliases” value to “global,SystemCore” (or just “SystemCore” if it’s blank to start with).

Then in your code, write:

extern alias SystemCore;
using SystemCore::System.Linq;

That will make all the relevant types etc in System.Core.dll’s System.Linq namespace available. The name “SystemCore” here is arbitrary – you could call it “DotNet” or something else if that would make it clearer for you.

Leave a Comment

tech