3

I have two multiline strings (in memory, not from files). How can I calculate a unified diff?

One solution would be to save the strings to temporary files, do a system call to diff -u and capture the output, but I'd rather do this in pure .NET. Happy to use NuGet package if it's not in standard library.

Colonel Panic
  • 132,665
  • 89
  • 401
  • 465
  • 3
    Might be what you need here: http://stackoverflow.com/questions/138331/any-decent-text-diff-merge-engine-for-net – Ulric Sep 30 '15 at 15:28
  • I don't want a "diff engine" just a bog-standard unified diff. – Colonel Panic Oct 13 '15 at 09:12
  • First, what do you mean "unified diff"? Second, once you remove the command line and the UI, there's no difference between a diff engine and the "bog-standard unified diff". And the linked question *does* include C# code – Panagiotis Kanavos Oct 14 '15 at 07:47
  • In any case, this question falls under several reasons to close - too broad, asking for third party tool, unclear what you are asking – Panagiotis Kanavos Oct 14 '15 at 07:48
  • 1
    Unified diff is a standard and quite well defined https://en.wikipedia.org/wiki/Diff#Unified_format `diff -u` also is an quite exact description of what is expected, and none of the answers or comments on https://stackoverflow.com/questions/138331/any-decent-text-diff-merge-engine-for-net does provide this from what I can find. @ColonelPanic Did you find any good options? – NiKiZe Oct 17 '19 at 02:10

0 Answers0