Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"Organize imports" in MonoDevelop

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. If there is no way to do this, how would one normally determine which library contained the class they were trying to use?

like image 770
Joel Avatar asked Dec 07 '09 08:12

Joel


2 Answers

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":

alt text

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.

like image 56
Matthew Avatar answered Oct 16 '22 21:10

Matthew


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.

like image 5
Stepan Stulov Avatar answered Oct 16 '22 19:10

Stepan Stulov