Sometimes I need to compare two methods, for example to check if they can be refactored into one. To avoid the time consuming step of copying the two methods into separate files and compare them, I recommend using the Visual Studio extension ClipboardDiff.
After installing the extension and restarting Visual Studio, open the menu Tools / ClipboardDiff Settings and set the path of your preferred diff tool. You can use the Visual Studio diff tool which will show the diff directly in the current Visual Studio instance:
Path to diff tool of Visual Studio 2012:
C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\vsdiffmerge.exe
Path to diff tool of Visual Studio 2013:
C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\vsdiffmerge.exe
Path to diff tool of Visual Studio 2015:
C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\vsdiffmerge.exe
To compare two code blocks, select the first one and copy it (CTRL-C), then select the second one, right-click and run “Diff selection against clipboard” (CTRL-ALT-J).
Tags: Diff, Extension, Visual Studio