基于C#文本比较的设计方法
我有一个 C# 项目,需要从一些文本文件中读取一些网格数据(两列,由可变数量的行形状数据组成),并在它们之间执行一些数学比较。你们认为在数据结构和设计方面表示这一点的最佳方法是什么?
样本数据表: 标签A:值A LabelB:ValueB
我正在考虑将所有数据读入 sqlite 数据库,然后使用查询使用 LINQ 对它们进行逐行比较?与将所有内容都放在内存数据结构中相比,您如何看待这个想法?如果还有其他想法,也请大声说出。谢谢。
I have a C# project whereby I need to read some grid data (two columns by variable number of rows-shaped data) from some text files and perform some mathematical comparisons across them. What do you guys feel is the best approach to represent this in terms of data structures and design?
Sample data table:
LabelA: ValueA
LabelB: ValueB
I was thinking about reading all of the data into a sqlite database and then using queries to do a row by row comparison against them using LINQ? What do you think of this idea vs having everything just in in-memory data structures ? If there are other ideas, please shout them out as well. Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我不会坚持它,除非将来完全有必要访问这些数据以避免重新处理所有内容。
我永远不会仅使用数组来实现此目的,我会构造一个对象来封装所有这些比较的逻辑。
我会简单地这样开始;
I would not persist it, unless it is totally necessary to access this data in the future avoiding re-processing everything.
I would never use just an array for this, I would construct an object in order to encapsulate the logic for all this comparisons.
I would simply start this way;
如果它只是临时的,我认为没有理由增加数据库的开销。只需将其存储在内存中即可。二维数组似乎是最明显的数据结构,除非您有数组不能完全满足的特定要求。
If it's only temporary, I see no reason to add the overhead of a database. Just store it in memory. A two-dimensional array seems the most obvious data structure, unless you have specific requirements that are not fully satisfied with an array.