Chapter 9. Routines

In this chapter:

  • Different types of routines

  • Advantages and disadvantages of routines

  • How the call stack works

  • Writing good routines

  • How parameters work

  • Passing values by value or by reference

  • Understanding value types and reference types

OFTEN, A PROGRAM MUST PERFORM THE same task in several different places. For example, a point-of-sale application might print a customer invoice as soon as a sale is complete. Each week, it might reprint invoices that are more than 30 days overdue. It might also allow you to select a customer and reprint that customer’s past invoices. In all three cases, the program does the same thing: it prints an invoice.

You could duplicate the code needed to print an invoice in all three places, but that would ...

Get Start Here!™ Fundamentals of Microsoft® .NET Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.