Sign In Start Free Trial
Account

Add to playlist

Create a Playlist

Modal Close icon
You need to login to use this feature.
  • Book Overview & Buying Visual Studio 2013 Cookbook
  • Table Of Contents Toc
Visual Studio 2013 Cookbook

Visual Studio 2013 Cookbook

4.2 (13)
close
close
Visual Studio 2013 Cookbook

Visual Studio 2013 Cookbook

4.2 (13)

Overview of this book

Table of Contents (17 chapters)
close
close
Visual Studio 2013 Cookbook
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
2
Index

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.

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

Getting ready

You will need Visual Studio Premium or Ultimate for this recipe. Start it up and you're ready to go.

How to do it...

  1. Create a new Class Library project under Visual C# and name it OriginalLibrary.

  2. Rename the Class1.cs file to the OriginalClass.cs file and allow Visual Studio to rename the class itself when prompted.

  3. Add a second C#-based Class Library project to the solution giving it the name DuplicateLibrary.

  4. Rename the Class1.cs file to the DuplicateClass.cs file, and as in step...

Visually different images
CONTINUE READING
83
Tech Concepts
36
Programming languages
73
Tech Tools
Icon Unlimited access to the largest independent learning library in tech of over 8,000 expert-authored tech books and videos.
Icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Icon 50+ new titles added per month and exclusive early access to books as they are being written.
Visual Studio 2013 Cookbook
notes
bookmark Notes and Bookmarks search Search in title playlist Add to playlist download Download options font-size Font size

Change the font size

margin-width Margin width

Change margin width

day-mode Day/Sepia/Night Modes

Change background colour

Close icon Search
Country selected

Close icon Your notes and bookmarks

Confirmation

Modal Close icon
claim successful

Buy this book with your credits?

Modal Close icon
Are you sure you want to buy this book with one of your credits?
Close
YES, BUY

Submit Your Feedback

Modal Close icon
Modal Close icon
Modal Close icon