No announcement yet.

Can I compare regions within a file?

  • Filter
  • Time
  • Show
Clear All
new posts

  • Can I compare regions within a file?

    I would like to compare two sections of a single file, ignoring all else. Specifically, I want to compare two methods in a single c# class file.

    I tried opening a text session w/ the same file on either side, then doing an "Align With..." but it didn't work too well. A few lines later it got radically out of synch. I also cut-n-pasted the two methods into their own files and compared. That works, but more manually than I want (I also had to paste mods back into the original).

    Is this possible?

    Double bonus: Automate launching the session. For example, if I could say "compare file A.cs lines 10-20 with file A.cs lines 25-35".

    Thanks for any suggestions you might have.

  • #2
    To do your manual method a bit more easily:
    Select the method on one side and copy to clipboard.
    Select the method on the other side, right click, and select Compare to Clipboard.

    This will open a new tab, comparing your two methods.

    For the Bonus: Beyond Compare, unfortunately, does not support line numbers as input. We can export them, however, using the Open With command, which could feed into a batch file which cuts your files accordingly, and then launches another comparison with new temp files. This would assume both methods are aligned on the current line, however.
    Aaron P Scooter Software