c# - How to call an extension method without using -


using system;  class runner {     static void main()     {         a = new a();         // how a.printstuff() without 'using'         console.read();     } }  class { }  namespace extensionmethod {     static class aextensions     {         public static void printstuff(this a)         {             console.writeline("text");         }     } } 

how call extension method without 'using'? , not extensionmethod.aextensions.printstuff(a), since doesn't make use of extension method.

that possible if extension method , class in same namespace,

if have use different namespaces have use using, don't think there way without using. may reduce number of using putting extensions in 1 namespace linq (system.linq.extensions)

note : can remove namespace extension methods, make them globally available


Comments

Popular posts from this blog

javascript - DIV "hiding" when changing dropdown value -

Does Firefox offer AppleScript support to get URL of windows? -

android - How to install packaged app on Firefox for mobile? -