C#文件比较并生成报告 [英] C# Files Compare and Generate Report
本文介绍了C#文件比较并生成报告的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有两个c#文件file1和file2,里面有代码行。修改后我要修改文件2我想根据文件2中发生的差异生成报告。
我生成了报告,但我的问题是类似的file2行只出现一次.. ..
例如;
File1 - > KB200 ,KB400
File2 - > KB600,KB600,KB400,KB200,KB700
报告 - > ; KB600,KB700
我想报告像这样KB600,KB600,KB700
I have two c# files file1 and file2 with there are lines of code. I'm going to modify the file2 after modifying i want to Generate report based on what are the differences happened in file 2.
I generated report but my problem is similar lines of file2 appearing only once....
For Eg;
File1 ->KB200, KB400
File2 ->KB600 ,KB600 ,KB400 ,KB200 ,KB700
Report -> KB600 , KB700
I want Report like this KB600 , KB600 , KB700
推荐答案
据我所知;你想比较File2和File1。
一个简单的策略:你可以遍历File2中的每个元素。对于每个元素;你会尝试在File1中找到该元素。如果找不到元素;将元素添加到报告文件中。这样,您最终得到一个包含File2所有元素的Report文件;它们未在File1中列出。相反的情况怎么样?
:)
As I understand it; you want to compare File2 against File1.
A simple strategy: You could walk through each element in File2. For each element; you'll try to find the element in File1. If element is not found; add the element to the Report file. This way you end up with a Report file with all the elements of File2; which are not listed in File1. What about the opposite situation?
:)
这篇关于C#文件比较并生成报告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文