When developing for Java in Eclipse, I can hit Ctrl+Shift+O to "Organize Imports", to have the IDE figure out which libraries I'm likely trying to use, and import them automatically.
Is there a similar feature in MonoDevelop for programming C#?
EDIT:
I'm new to C# and the whole Microsoft space. 开发者_如何学PythonIf there is no way to do this, how would one normally determine which library contained the class they were trying to use?
A similar feature was added in MonoDevelop 2.2 (the latest version).
You can use it by right-clicking on an unrecognized type, and hovering over "Resolve":
If the type is recognized (i.e., if you were already using Gdk;
in the above example), you will not see this menu.
If you're using Ubuntu Karmic, the version of MonoDevelop in the repositories is 2.0. You'll need to add this PPA to upgrade. If you're using Windows or OS X, you can download MonoDevelop 2.2 from the MonoDevelop website.
Try using ctrl+alt+space on mac, instead of just ctrl+space for an unimported class. It will offer you to import it. No need to switch to mouse, click "Resolve". Works in MonoDevelop 4.0.1 that's bundled with Unity3D for me. Worked with an older version of bundled MonoDevelop too, as far as I remember. Never tried for a unity-free MonoDevelop though.
I do not think MD currently has the first feature.
Although recent version has the possibility to add "using namespace" for classes you are using.
For example, type: List<int> =
Right click on List and you will have Resolve menu that will add proper using statement to the top of the file. Although it will search only referenced libraries, and will not add anything to references.
There is a refactor menu on usings, too, that can remove uneeded usings from file.
(I'm not sure if this features are avaialble in MD 2.0 or 2.2 or only trunk, as I'm using the trunk version)
I don't know a lot about MonoDevelop; Visual Studio 2008 has an "Organize Usings" menu that drops unnecessary usings. I think the ability to reference missing namespaces automatically is a feature only in the third-party Resharper addin.
Re your second question: the MSDN page for a class tells you the assembly and namespace you need in order to use that class. I normally do a Google search for "site:msdn.microsoft.com NameOfClass".
精彩评论