This may be an ignorant question, but I\'m unsure why I can not use namespace aliasing and extension methods together.
The following example works just fine:
I also love to use namespace aliasing
but its not working in case of Extension methods. So one thing that i did is, I changed the namespace
of extension class to same namespace that my main project
has (although my extension class resides in sub folder of main project).
Suppose I have a project myFirstProj
which surely has namespace myFirstProj
for root classes. My extension class is present in myFirstProj/Common/myExtensionClass
with contains namespace myFirstProj.Common { //myExtensionClass }
.
So now what I did is, I changed the namespace
of myExtensionClass
from namespace myFirstProj.Common{ //myExtensionClass }
to namespace myFirstProj{ //myExtensionClass }
.
Now i can use my extension methods
in my whole project myFirstProj
event without specifying using statement for my extension class.
I know this isn't a standard way to that but I haven't found any other workaround for it expect this one because for my Project there is a requirement to go with namespace aliasing
for project namespaces.