内部存储数据C# [英] Store data internally C#
问题描述
我对C#中的数据处理有疑问.
I have a question about data handling in C#.
这里有个例子可以弄清楚:我(作为客户端)需要将文件名写入程序,以便以后可以使用这些文件名.但是,我需要(在我的机器上)能够将这些文件名输入到控制台(我是从C#构建的)中,然后将这些名称在内部进行处理(因此,没有文本文档会存储输入的数据),以便我可以发送将该应用程序复制到其他计算机上,并且仍然记住了名称.
Here is an example to make things clear: I (being the client) need to write filenames into a program so that I can use those filenames later on. However, I need to (on my machine) be able to enter those filenames into a console (that I build from C#) and then those names to be handled internally (so no text documents storing the entered data) so that I can send the same copy of the app to other machines and it still have the names remembered.
我可以用C#做到这一点的任何方式吗??
Any way that I can accomplish this in C#..?
我们非常感谢您的帮助.预先感谢!
Any help is much appreciated. Thanks in advance!
推荐答案
否,您无法在可执行文件运行时对其进行修改;它是代码中的已编译程序集,将值保存到正在运行的可执行文件中是没有意义的.您要求它执行的操作是不可能的.
No, you cannot modify an executable while it is running; it's a compiled assembly from your code, and saving values to a running executable makes no sense. What you're asking it to do is not possible.
如果您出于安全考虑或可以使用数据库,则至少可以将信息存储在二进制加密文件中.有几种本地存储方式(即不需要DBMS).
You can store your information in a binary, encrypted file at the very least if you're concerned with security or you can use a database. There are several ways to store locally (i.e. not require a DBMS).
Here's a link to a useful SO post: What is a good choice of database for a small .NET application?
这篇关于内部存储数据C#的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!