Question

i don't know if I'm explaining my self right but what i want is to save my program variables and information in one file and then start this file with this program. my idea is like a .docx file that opens with MS Word and if this available can anyone show how to do it and how to make the computer start my program when ever a file with a .yaser extension is opened thanks in advance to anyone that helps me :)

Was it helpful?

Solution 2

What you want to do is save all the variables in a custom class serialize it using link this might help you.

OTHER TIPS

You can put all the important data in a state class, and then serialize it to file in a binary, XML or JSON format. When your application is restarted, you can deserialize this file back to a class instance and use it.

For binary serialization look at BinaryFormatter, for XML - XmlSerializer, for JSON you can user JSON.Net

You may also need some plumbing code to rebuild caches, resubscribe to events, e.t.c.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top