O'Reilly logo

Start Here!™ Fundamentals of Microsoft® .NET Programming by Rod Stephens

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

Summary

This chapter explained routines, which are named pieces of code that other pieces of code can invoke to perform specific tasks. Routines make programming easier and less error-prone by:

  • Reducing duplicated code

  • Reusing code

  • Simplifying complex code

  • Hiding implementation details

  • Dividing tasks among programmers

  • Making debugging easier

The only real drawback to routines is that a routine call requires some overhead. Because they have many advantages and only one small disadvantage, routines are part of most programs.

Writing and using routines is relatively easy. The only really complicated part is understanding how value and reference types behave when you pass them to a routine by value or by reference. Table 9-2 summarizes the combinations.

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