O'Reilly logo

Visual Studio 2012 Cookbook by Richard Banks

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Detecting duplicate code

Copy and paste development is generally regarded as a bad practice because bug fixes or enhancements in one area of code have to be repeated in all the other copies of the same code. Not only is this time consuming and tedious, but in large code bases it's very easy to miss a change, leading to bugs and lower overall quality.

In Visual Studio 2012, Microsoft has provided a way to detect duplicate code so that you can take remedial action to clean it up. Fantastic! Let's see how this is done.

Getting ready

Start Visual Studio 2012 and you're ready to go.

How to do it...

  1. Create a new C# Class Library project and name it OriginalLibrary.
  2. Rename Class1.cs to OriginalClass.cs and allow Visual Studio to rename the class itself when ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required