1

How can I disable automatic namespace resolution in Intellisense for C# (Visual Studio 2010)?

This might sound strange but I need to have the fully qualified names show up as follows:

System.Windows.Forms.Form form = new System.Windows.Forms.Form();

Instead of:

Form form = new Form();

I could not find similar questions. Is this possible in VS2010?

UPDATE: I am aware about readability issues and when sharing code, qualified can be stripped easily. It is just a matter of preference in writing code that way.

Raheel Khan
  • 14,205
  • 13
  • 80
  • 168
  • 2
    This really appears to be an [XY Problem](http://meta.stackexchange.com/questions/66377/what-is-the-xy-problem). What is actually solved by this? In other words, you believe that by solving this problem it will solve some other problem (of which you have not asked). – Erik Philips Jan 08 '13 at 21:17
  • 1
    what is the purpose? This will make your code readability very poor. – Yusubov Jan 08 '13 at 21:19
  • @ErikPhilips: No ulterior motives. I am used to reading code with fully qualified namespaces for a decade now and find it annoying to have to type them out. – Raheel Khan Jan 08 '13 at 22:07
  • @ElYusubov: The code I write is mostly for myself and when sending it off, tools like ReSharper can toggle between fully qualified and relative with a click of a button. – Raheel Khan Jan 08 '13 at 22:08
  • 2
    And why the down vote? Most people may not be comfortable doing it that way but that does not make this a bad question. – Raheel Khan Jan 08 '13 at 22:14
  • 1
    This also sounds to me like an anti-pattern. – Yusubov Jan 08 '13 at 22:21

1 Answers1

0

By default the fully qualified names will show up if you start typing the namespaces.

So start by typing System, and you'll see a list of symbols in the System namespace. and you can continue on like that until you have System.Windows.Forms.Form

If you really really badly want intellisence to stop giving you stop resolving namespaces, than you can just delete all the using statements at the top of your file, and then paste them back in when you're done. I wouldn't do this if I were you, but then again, I wouldn't want to stop resolving namespaces either.

  • That only happens if the name you type is not within the namespace hierarchy of the class you type in. It should also not be in `using` statements of course. – Raheel Khan Jan 08 '13 at 22:15
  • @RaheelKhan I think you misunderstood. Don't start with typing "Form" start with typing "System" – Sam I am says Reinstate Monica Jan 08 '13 at 22:18
  • That does not work for me without having to type it out until I reach "Form". That is annoying. – Raheel Khan Jan 08 '13 at 22:27
  • @RaheelKhan with intellisence you just have to type as far as `Sy` and then `System` will be probably be highlighted, in which case you can just press the `.` key and continue with `Windows` – Sam I am says Reinstate Monica Jan 08 '13 at 22:29
  • 1
    If you remove the using namespaces and type Form, the F should be underlined (works with all classes). In cases where the first letter is underlined of any class that is contained in a reference but not in a using clause, you can press Ctrl+. (Ctrl+Period) and it will give you the option to EITHER; add a using statement, or prefix form with the namespace containing the class. – Erik Philips Jan 08 '13 at 23:14