Home > dotnet > Announcing “Refactoring with C#”

Announcing “Refactoring with C#”

Safely improve .NET applications and pay down technical debt with Visual Studio, .NET 8, and C# 12

Published: Last Updated on

I'm pleased to share that I have completed my first technical book: "Refactoring with C#" with Packt Publishing. The book is in final preparation for publishing and goes live on Amazon on November 24th.

Book cover for Refactoring with C#

I've been a developer for over several decades, I've worked with .NET since beta 2, and I've had the privilege to teach new learners .NET the past 3 years. To me, this book was the perfect opportunity to continue to invest in those people as their careers progressed from junior to mid and beyond.

During my time in the workforce, I've worked in less-than-optimal codebases (and even created a few myself). As part of stabilizing and improving those organizations, I learned to safely refactor code in a reliable and repeatable way. Refactoring with C# is my opportunity to share these techniques and strategies with engineering leaders responsible for maintaining old codebases and budding new developers who find themselves working in these areas.

The book provided an opportunity to talk about the latest and greatest .NET and C# features as well as sharing specific actionable tips around libraries like Shouldly, Scientist .NET, Snapper, and more to give you the safety net you need to make major changes and improve the stability and maintainability of your code.

Book Structure

The book is broken up into 4 major parts:

  1. Refactoring with C# in Visual Studio covers the refactoring process and tools. We start with some simple refactorings and then move into chapters dedicated to refactoring individual lines, full methods, and entire classes using object-oriented programming techniques.
  2. Refactoring Safely covers unit tests in xUnit, NUnit, and MSTest. This part starts at the basics, moves into data-driven tests and test-driven development, and then moves to advanced testing libraries and techniques. This section also covers SOLID principles as well as using modern C# language features (including some new to C# 12) to build safer codebases.
  3. Advanced Refactoring with AI and Code Analysis starts out with a tour of using GitHub Copilot Chat to help analyze, refactor, document, and test some code in need of refactoring. The following three chapters talk about code analysis systems and tools, with a heavy focus on the built-in Roslyn Analyzers. The final two chapters of this section explore how to create and publish Roslyn Analyzers of your own to flag issues and even automatically fix them.
  4. Refactoring in the Enterprise talks about organizational challenges in refactoring, including getting buy-in and time to change code, dealing with larger scale refactorings, and enforcing code standards through EditorConfig files.

The book is 17 chapters long and I had a blast writing it.

Other Contributors

I wasn't alone in writing this book. In addition to Packt's editorial team, I had four amazing technical reviewers in Matthew Groves, Calvin Allen, Sam Gomez, and Brad Knowles. These individuals helped expand and contract the scope of each chapter, found a few issues in samples, and helped support the overall approach of the book.

Finally, Steve "Ardalis" Smith joined on as a foreword writer, but also provided a comprehensive technical review of the book with his own suggestions.

These individuals are all part of my regional tech community and share the same commitments I do in mentoring new developers and equipping seasoned developers with the tools and techniques they need to succeed.

Next Steps

Refactoring with C# releases on November 24th (Black Friday in the States) on Amazon in paperback and digital formats. It can also be found on Packt's website as well. The book was written against C# 12 and .NET 8 using Visual Studio 2022.

I hope you enjoy the book and it teaches you valuable new approaches to a critical aspect of software development. Please let me know what you think by leaving a review or getting in touch.


  • Matt Eland
    Microsoft MVP in AI, Author of "Refactoring with C#"

    Matt Eland is a software engineering leader and data scientist who has served as a senior engineer, software engineering manager, professional programming instructor, and has helped build enterprise-level software at a variety of organizations before distinguishing himself as a Microsoft MVP in Artificial Intelligence by using technology to accomplish ridiculous things in the name of science and teaching others. Matt makes it his job to learn new things and share them with others through articles, videos, and talks at user groups and conferences covering a wide range of topics from software architecture to programming topics to artificial intelligence and data science. Matt is a current data analytics master's student, an AI Specialist at Leading EDJE, is the author of "Refactoring with C#" and is creating a LinkedIn course and book on Computer Vision on Azure. Matt occasionally sleeps as well.

    View all posts

Leave a Reply

Related Content

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More