如何正确保存应用数据以备后用 [英] How to properly save application data for later use
问题描述
好的,所以我正在开发一个 c# windows 窗体应用程序,它使用不同类型的结构来保存数据并向用户显示.我想使用 saveDialogBox 来允许用户保存信息(即配置、状态).我能想到的唯一方法是制作一个例程,通过结构并将相应的元素写入文本文件.加载时,此例程将用于加载数据.
我承认,这当然是一种愚蠢的做法.我在学校所做的任何事情都只是写入文本文件.有没有其他方法可以制作一些格式化的文件来保存和加载?
我一直在研究将对象保存到文件的序列化.我不太确定这一切是如何运作的.帮助.
保存您的应用程序设置 .. 我认为这些链接会对您有所帮助
http://msdn.microsoft.com/en-us/library/aa730869%28VS.80%29.aspxhttp://www.thescarms.com/dotnet/AppSettings.aspx
和
Ok, so I am working on a c# windows forms application and it uses different types of structures that hold data and display to the user. I want to use a saveDialogBox to allow the user to save the information(i.e configuration, state). The only way I can think to do this is to make a routine that goes through the structures and write the corresponding elements to a text file. Upon loading this routine would be used to load the data back.
This is of course a dumb way to do it I'll admit. Anything I've done in school was only writing to text files. Is there other ways to make some formatted file to save and load from?
I've been looking at serialization to save objects to files. I am not too sure how all this works though. help.
to save your application setting .. I think these links will help you
http://msdn.microsoft.com/en-us/library/aa730869%28VS.80%29.aspx http://www.thescarms.com/dotnet/AppSettings.aspx
and
How to use settings in Visual C#
这篇关于如何正确保存应用数据以备后用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!