Finding Clone Codes in Visual Studio 2011 Developer Preview

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

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

image

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 

Yes, this is really nice and interesting .

Cheers !

Aj

Abhijit Jana

Abhijit runs the Daily .NET Tips. He started this site with a vision to have a single knowledge base of .NET tips and tricks and share post that can quickly help any developers . He is a Former Microsoft ASP.NET MVP, CodeProject MVP, Mentor, Speaker, Author, Technology Evangelist and presently working as a .NET Consultant. He blogs at http://abhijitjana.net , you can follow him @AbhijitJana . He is the author of book Kinect for Windows SDK Programming Guide.