Skip to Content
C# 10 and .NET 6 – Modern Cross-Platform Development - Sixth Edition
book

C# 10 and .NET 6 – Modern Cross-Platform Development - Sixth Edition

by Mark J. Price
November 2021
Intermediate to advanced content levelIntermediate to advanced
826 pages
20h 10m
English
Packt Publishing
Content preview from C# 10 and .NET 6 – Modern Cross-Platform Development - Sixth Edition

04

Writing, Debugging, and Testing Functions

This chapter is about writing functions to reuse code, debugging logic errors during development, logging exceptions during runtime, unit testing your code to remove bugs, and ensuring stability and reliability.

This chapter covers the following topics:

  • Writing functions
  • Debugging during development
  • Logging during runtime
  • Unit testing
  • Throwing and catching exceptions in functions

Writing functions

A fundamental principle of programming is Don't Repeat Yourself (DRY).

While programming, if you find yourself writing the same statements over and over again, then turn those statements into a function. Functions are like tiny programs that complete one small task. For example, you might write a function ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

C# 8.0 and .NET Core 3.0 – Modern Cross-Platform Development - Fourth Edition

C# 8.0 and .NET Core 3.0 – Modern Cross-Platform Development - Fourth Edition

Mark J. Price

Publisher Resources

ISBN: 9781801077361Supplemental Content