10

I'm looking for an open-source diff tool that I can integrate in my C# code.

I am comparing two strings of text and want to render my output to look similar to the Stack Exchange diff tool:

inline:

enter image description here

side-by-side:

enter image description here

Stack Exchange uses Beyond Compare, which seems to do a very nice job comparing changes, but I am looking for something that is free.

I found a few posts on Stack Overflow talking about diff tool recommendations, yet these questions are off topic for Stack Overflow and were closed, so the answers given are very likely not maintained. Also, all these questions were posted a few years ago, and so the technology suggested may no longer be the best software available.

Here are the SO questions for reference:

These are some of the suggestions posted, yet I don't know if they are still recommended or if better technology now exists:

2
  • Would you mind telling us what you eventually selected?
    – RenniePet
    Feb 3, 2018 at 15:01
  • 1
    @RenniePet I think I ended up using a version of the Google Diff, Match, Patch library, however, I have since moved on from that job and can't check. I do remember though, I wasn't thrilled with the comparison algorithm results of whatever code I ended up with, and that is why I never added it as an answer. Although I am no longer looking for a solution, it would be nice if someone can still suggest a tool they use that works well, so others can refer to this question as a reference in the future.
    – Tot Zam
    Feb 4, 2018 at 16:34

1 Answer 1

3

A bit late but I recently wrote a C# library and accompanying console program which compares 2 strings and shows the difference in 2 html-files.

It can be found here. Hopefully someone reading this question finds it useful.

4
  • I'm no longer working on this project, but always appreciate an answer and hopefully someone else will find it useful. Just a tip, it may be helpful if you add some sort of screenshot or demo to your GitHub repo README.
    – Tot Zam
    Jan 26, 2020 at 4:06
  • Although you might not need it yourself anymore, can you mark my/this post as the answer if you think it answered the question ? Both for future readers of this question and for me to earn my kudos. By the way, I followed up your suggestion and added some screenshots to to the repository. Jan 26, 2020 at 21:55
  • I can't feel comfortable accepting an answer that I haven't tested since I have no way of knowing if it really can accomplish what I asked in the question. I've tried multiple diff tools in the past, and each one had its pros and cons, so I have no way of knowing where your's falls since I am no longer working on the project and am not testing your library on actual text. If your answer does help other people in the future though, I'm sure you will get more upvotes. And the screenshots definitely help demonstrate if your library is something worth trying.
    – Tot Zam
    Jan 27, 2020 at 2:38
  • I can confirm the library works for me so far. Thanks much!!!
    – bobt
    Mar 17 at 0:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.