Chapter 3

Writing methods and applying scope

After completing this chapter, you will be able to:

  • Declare methods, pass information to a method, and return information from a method.

  • Call methods.

  • Define local and class scope.

  • Use the integrated debugger to step into and out of methods as they run.

  • Use optional parameters and named arguments with methods.

In Chapter 2, “Working with variables, operators, and expressions,” you learned how to declare variables, how to create expressions using operators, and how precedence and associativity control the way in which expressions containing multiple operators are evaluated. In this chapter, you’ll learn about methods. You’ll see how to declare and call methods, how to use arguments and parameters ...

Get Microsoft Visual C# Step by Step, 10th Edition 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.