Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

exclude a class from a used namespace

The first statement of all my C# files is "using System;". Now with framework version 4 this namespace contains a class called "Action". This is also the name for a class im my own code in a regularly used namespace. Now there is of course a conflict. Ofcourse I can resolve this conflict by using explicit "MyNamespace.Action" where ever I was using "Action" before. This are several hundreds if not thousands of lines. Or I could not use the System namespace, which of course leads to many other problems. I would like to write something like "using System but not System.Action", but I cannot find a statement to do this. Any ideas?

like image 955
Gerhard Avatar asked Sep 13 '12 12:09

Gerhard


1 Answers

No, you can't.

But you can add using Action = MyNamespace.Action. This will be highly confusing for new developers, though, as Action is a fundamental part of .net since 3.5 so I strongly suggest you rename your class.

like image 199
erikkallen Avatar answered Oct 07 '22 18:10

erikkallen