简体   繁体   中英

How can I inform my managed DLL about my managed application types

I have a situation where I have a C# Managed DLL that is handling incoming real time data. The DLL filters and saves up to 200 of the most recent data points in a FIFO. I also have a C# application that on occasion needs to get some of the data from the DLL. I can easily setup methods in the DLL to return single values of the built in data types.

What I need is a way to pass a reference to my user defined type (EX: List ) to the DLL and have it fill it in. I cannot seem to find any way to tell the DLL about my types and the compiler complains that I do not know what I am doing. This is true. I have tried everything I can find on the internet.

Further my application already has a reference to the DLL so that it can start it up and respond to events, therefor I cannot add a reference to my application within the DLL without creating a circular reference.

So how can I inform my managed DLL about my managed application types? The end goal is to be able to pass an ObservableCollection and have the DLL fill in MyObject with data from its local cache of data points.

When searching the internet it seems that the managed to unmanaged scenario outweighs the managed to managed scenario by 98 plus percent.

Any ideas would be greatly appreciated.

To compile my comment as an answer:

You should have (naming is just ilustrative):

  • DataContract.dll with the definition of your types.
  • BusinessLogic.dll with the logic.
  • And Application.exe with your presentation logic.

DataContract.dll can then be referenced by both - BusinessLogic.dll and Application.exe.

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