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 aliased using, there problem include function, extension method:
using sp = microsoft.sharepoint.client class dummyaliased() { void dummyfunction(sp.clientcontext ctx, sp.listcollection lists) { /* not compile: */ context.load(lists, lc => lc.include(l => l.defaultviewurl); /* compiles (not using function generic) */ context.load(lists, lc => sp.clientobjectqueryableextension.include(lc, l => l.defaultviewurl)); } } the include function can still used, not extension method. there way use extension method without un-aliasing using directive?
not before c# 6... in c# 6 can use:
using static microsoft.sharepoint.client.clientobjectqueryableextension; using sp = microsoft.sharepoint.client; the first of these pull in just static members of clientobjectqueryableextension available, without rest of namespace.
Comments
Post a Comment