简体   繁体   中英

C# - Export class/enum from another project to .dll

I have here project MDevice (just a random name) that has an enum :

namespace MInterface {  

  [Serializable]
  public enum OMode : byte {
    Fly = 0x00,
    Die = 0x01,
    Cry = 0x02,
  }
}

Now I got another project MInterfaceToSomethingElse which is just a library-project which I want to use in another project.

Now here is the thing, I need the enum OMode in MDevice but I also need to make it public accessible in my .dll MInterfaceToSomethingElse .

Is there something like

namespace SomewhereInMInterfaceToSomethingElse {

   __exportToDll MInterface.OMode;

   // ...
}

I tried to keep it small and simple. The reason why I want to do this is because I am using a Java/C#.NET bridge for an Eclipse-Plugin. The framework that generates the bridge takes a look at all public classes and makes them accessible for me in a Java application (just so you guys know what I am doing this for).

Is there a way to do this? I want to avoid writing a wrapper class or create a 'shared' project that is included by both projects if possible..

Best regards

put enum to class-library project which produce you a separate dll. Then reference to this dll (or project) in another projects (MDevice and MInterfaceToSomethingElse). Is this is what you need?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM