Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

C#/.NET How do I find the containing namespace from a class name

I often find myself remembering the name of a class that I want to use, but not remembering the containing namespace. Apart from searching the web, i wonder if a good method exists for looking this up.

like image 302
S.C. Madsen Avatar asked Nov 11 '09 20:11

S.C. Madsen


2 Answers

If you know the name of a class in .Net but have no idea what namespace it is in, it can be hard finding it, especially if you dont have a reference/using to the assembly containing it.

This is where the Object Browser (Ctrl+W,J) comes in handy.

Open it up, type in the name, it will give you all matches, either within your project/solution, or all of the .Net framework.

Edit:
As S.C. Madsen's comment points out, this also helps if you only remember PART of a class name, also if you only remember a method name but not the class.

like image 173
Neil N Avatar answered Oct 22 '22 04:10

Neil N


CTRL + '.' will bring up a menu where you can either add a 'using' or fully qualify the class.

like image 30
Philip Wallace Avatar answered Oct 22 '22 05:10

Philip Wallace