Finding Clone Codes in Visual Studio 2011 Developer Preview
By | October 18, 2011

Visual Studio 2011 Developer preview introduced a nice features that enables you to find the out the duplicate codes across the projects and solutions. This helps you to identify the duplicate code and logics which can be refactored and can be rewritten in a common method. Let’s have a look how to use it.

First select line of codes  which you can think used in multiple places. Right Click and Select “Find Matching Clones in solutions

image thumb26 Finding Clone Codes in Visual Studio 2011 Developer Preview

This will search all the codes with in the solution semantically and display  result in Code Clone Search Result window.

image thumb27 Finding Clone Codes in Visual Studio 2011 Developer Preview

Code clone window will display the from – to line number along with the  files name. You can click on that  line to navigate to the code block or just mouse hover to see the cloned code.

image thumb28 Finding Clone Codes in Visual Studio 2011 Developer Preview 

Yes, this is really nice and interesting .

Cheers !

Aj