import - How can I avoid typing the full namespace hierarchy for c# objects in Monodevelop ("using" isn't working)? -


i have hierarchy of namespaces my.namespace.myobject in library. understanding if include using my.namespace; @ top of source file should able use object directly. unfortunately, works if type out entire my.namespace.myobject, neither namespace.myobject nor myobject alone work. in trying research i've found can happen when classes , namespaces share names not case me. it's hard google "using not working" haven't been able find else might relevant.

a full example follows. in 1 project do:

namespace {    namespace namespace {        public struct myobject {}    } } 

then build produces dll file. in second project add dll reference , do: using my.namespace;

public class anotherobject {    public static void main()    {       //results in compilation error, while my.namespace.myobject doesn't       myobject a;    } } 

project a, compiled librarytest.dll:

namespace firstlevel {     namespace secondlevel      {         public class libraryclass         {             public libraryclass()             {             }              static void main()              {             }         }     } } 

project b, console app, using project library:

using firstlevel.secondlevel;  namespace consoletest {     class mainclass     {         public static void main (string[] args)         {             libraryclass test = new libraryclass();         }     } } 

important: make sure library added references in other project

  • right click on references -> edit references...
  • switch .net assembly
  • click on browse...
  • select library

see attached screenshot.

enter image description here enter image description here


Comments

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -