C# 比较算法

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/65199/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-03 10:30:39  来源:igfitidea点击:

C# compare algorithms

提问by public static

Are there any open source algorithms in c# that solve the problem of creating a difference between two text files?

c#中是否有任何开源算法可以解决在两个文本文件之间创建差异的问题?

It would be super cool if it had some way of highlighting what exact areas where changed in the text document also.

如果它有某种方式突出显示文本文档中发生更改的确切区域,那将是非常酷的。

回答by eladv

Check out diff. Here it is in the gnu project(open source, of course), and many more links to implementations are found in the wikipedia article. A comparison of different such programs is found here.

查看差异。这是在 gnu 项目中(当然是开源的),在维基百科文章中可以找到更多实现的链接。可以在此处找到不同此类程序的比较。

回答by cfeduke

There is Menees Diffwhich will provide you with a C# diff implementation. The source code is included. I've used it in the past with good success wrapping it in my own implemenation.

Menees DIFF这将为您提供一个C#diff实现。包含源代码。我过去使用过它并成功地将它包装在我自己的实现中。

回答by Tarek Mohamed

check this link "good line by line Diff Algorithm " http://www.codeproject.com/KB/recipes/diffengine.aspx

检查此链接“良好的逐行差异算法” http://www.codeproject.com/KB/recipes/diffengine.aspx

回答by Goran

There's also a c# port of Google's (Neil Fraser) diff, match and patch.

还有谷歌 (Neil Fraser) diff, match 和 patch的 ac# 端口。

回答by Robert Swift

How about this one? : DIFFPLEX

这个怎么样?: DIFFLEX