Visual Studio 2012 and finding copy-paste code
Posted: (EET/GMT+2)
Although most of us don't think it's a sign of good programming, copy-paste coding is something everyone has done from time to time, especially when working under a tight schedule. Copy-paste coding can be efficient, but the problem is that it leaves multiple, similar code blocks in your application. Should you ever need to modify one of them, you might need to find all of them, and edit them all in the same way. This is a risky business, and not very time-efficient.
In Visual Studio 2012, there's a new feature called Analyze Solution for Code Clones, which allows you to find duplicate code blocks (code clones) within your .NET applications. The only limitation is that this works only for blocks that are longer than ten lines.
To access this feature, check the new Analyze menu in Visual Studio 2012. Here's another document showing an example how to use this feature.