在C#中读取和比较文件处理 [英] read and comparison of file handling in c#

查看:83
本文介绍了在C#中读取和比较文件处理的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我必须在c#中创建2个文本文件,并且在两个文件中有一些行.有些行是相同的.有些行是完全不同的.有些行是部分相似的.然后从这些文件中读取数据.并需要4个按钮进行比较.每个按钮都有一个问题,然后单击该按钮将在标签或文本框中显示ans.
比较的问题如下.

1.几行相似.
2.部分相似的行(匹配某些字符).
3.根据字方向,有多少行不相似.
4.根据词义,有多少行不相同.

我是文件处理的新手.请帮我做这个.这是我的面试问题,因此请充分帮助.

i have to create 2 text files in c#.and there is some lines in two files. some lines are same. some lines are completely differnt. some lines are partially similar. and then read the data from those files. and need 4 buttons for comparison.each button has a question and click on that button will give the ans in a label or text box.
the question for comaparison are below.

1. how many lines are similar.
2. how many lines are partial similar(match some character).
3.how many lines are dissimilar according to wordcoundwise.
4. how many lines are dissimilar according to wordwise.

i m new in file handling. please help me for making this. this is my interview question so please fully help needed.

推荐答案

您好,
关于CP的许多文章都与文件比较有关.请参考以下链接:
EHFileDiff-文件比较实用程序 [用于精益和均值竞赛的文件比较实用程序 [ ^ ]
Directory Comparer-用于比较2个文件夹的递归工具 [ ^ ]
MeanFileCompare-文本文件比较 [
Hi,
There is many article on CP related to file comparison. Refer the links below:
EHFileDiff - File Compare Utility[^]
File Compare Utility for Lean and Mean Contest[^]
Directory Comparer - A recursive tool to compare 2 folders[^]
MeanFileCompare - Text file comparison[^]



--Amit




在我的技巧中,我创建了一个API,用于比较两个文本消息的相似性.您可以在
此处 [本文 [ ^ ]了解C#中的文件处理.

希望以上信息能帮助您开发程序.

谢谢
-Amit Gajjar
Hi,

In my Tip/Trick i have created one API for comparison of two text messages for similarity. you can find it Here[^]

From above example you can get some idea about how you can achieve your goal. you need to create two text reader for two file comparison. After each of the read method call you can compare both the line and increment the counter depending on the button click event.

if you would like to create this utility then you need knowledge in File Handling. Please check this article[^] to understand file handling in c#.

Hope above information will help you to develop your program.

Thanks
-Amit Gajjar


这些可以帮助您..
1. http://support.microsoft.com/kb/320348 [ http://social.msdn.microsoft. com/Forums/pl-PL/csharpgeneral/thread/ad07af87-4664-4475-a820-d77c756a93f7 [
These can help you..
1.http://support.microsoft.com/kb/320348[^]
2.http://social.msdn.microsoft.com/Forums/pl-PL/csharpgeneral/thread/ad07af87-4664-4475-a820-d77c756a93f7[^]


这篇关于在C#中读取和比较文件处理的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆