like this
public class MyClass {
public static instance = new MyClass();
private List<int> idList;
}
.
I am using this class in two different window application. like this MyClass.instance.IdList.Add(1);
All data in idList i am storing in file and fetching info from that file. I am adding value to idList in one app and I am fetching idList info in another app. but it is not showing idList content in second application which is added by first apllication. How to achive this?
Here are a few ways to share data between applications:
WCF would be my preferred way to do this and I will add some explanation here
1) Use of WCF - Host a WCF service with following functionality [Effort: Moderate]
//Notice the use of Publisher -Subscriber pattern here (each app will subscribe to the service, the service could be hosted by all apps at certain endpoint i.e. net.pipe://localhost/NotificationService (Since multiple applications will try to host the same service only one would succeed and that's exactly what we want)
void Subscribe(object);
void Unsubscribe(object);
// Any client wanting to add an object to the list will call Add
void Add(object objectToAdd);
// Iterate through each subscribing app and send a notification that list changed
void Notify();
// Return the current state of list
IEnumerable<object> GetYourList();
2) Use of Clipboard [Effort: Simple]
3) Use of File system & listening to the file change notification [Effort: Simple]
4) Memory Mapped Files [Effort: Simple-Moderate]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With