且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

为下次启动存储字符串数组!

更新时间:2023-11-07 08:54:46

您可以使用BinaryFormatter序列化包含数组的对象.
这将创建对象的二进制映像,您可以将其写入二进制文件.

MSDN BinaryFormatter
You can use the BinaryFormatter to serialize an object containing your array.
This will create a binary image of your object which you can write to a binary file.

MSDN BinaryFormatter


如果数组中的值是固定的,并且它是一个小的实用程序,则可以将其作为数组变量存储在代码本身中.否则,如果您知道它可能会被用户修改,则可以选择一个单独的文本文件,一个资源文件(.resx)或作为配置数据存储在DB中.
If the values in the array is fixed and it''s a small utility program you can store it in the code itself as an array variable. Otherwise if you know it may get modified by the user you may choose either a separate text file, a resource file (.resx) or store as configuration data in the DB.


ab)为此使用Windows注册表
you can (ab)use the windows registry for this