节省少量配置的最佳方法 [英] Best way to save low amount of configuration
问题描述
我必须保存我的设备配置,一位朋友告诉我,因为它只有 2(两个)字段,最好在 .txt 文件
上保存/读取它创建一个表.是真的吗?
它会更快吗?或者没关系?
如果是这样,我该怎么做?
我知道如何使用 System.IO
和 StreamReader/StreeamWriter
在文本文件上Write/Read
.
我只是想知道它是否真的会更快,以及如何读取它并将读取的值设置为配置的想法......也许使用数组并使用 Split
?
I have to save the configuration of my device, and a friend told me that as it is just 2(two) fields, it would be better save/read it on a .txt file
instead create a table. Is that true ?
Will it be quite faster? Or doesn't matter ?
If so, how may I do that?
I know how to Write/Read
on text file using System.IO
and StreamReader/StreeamWriter
.
I just wanted to know if it is true that it would be faster and an idea of how could I read it and set the value read to the configuration.... Maybe using array and use Split
?
推荐答案
从性能的角度来看,这并不重要,所以不要自己动手,只需使用内置的 C# properties/app.config 实现即可.
It shouldn't really matter from a performance perspective, so don't roll your own just use the built in C# properties/app.config implementation.
这篇关于节省少量配置的最佳方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!