The following code compiles:
using Microsoft.SharePoint.Client class Dummy() { void DummyFunction(ClientContext ctx, ListCollection lists) { Context.Load(lists, lc => lc.Include(l => l.DefaultViewUrl); } }
However, when switching to using aliases, there is a problem with the Include function, which is an extension method:
using SP = Microsoft.SharePoint.Client class DummyAliased() { void DummyFunction(SP.ClientContext ctx, SP.ListCollection lists) { Context.Load(lists, lc => lc.Include(l => l.DefaultViewUrl); Context.Load(lists, lc => SP.ClientObjectQueryableExtension.Include(lc, l => l.DefaultViewUrl)); } }
The Include function can still be used, but not as an extension method. Is there a way to use it as an extension method without smoothing the use directive?
c # extension-methods
Hutch
source share