Summary


In this chapter, you've seen a fairly complete overview of the use of functions in C# code. Much of the additional features that functions offer (delegates in particular) are more abstract, and you need to understand them only in the light of object-oriented programming, which is a subject that you will encounter in Chapter 8.

This chapter covered:

  • Defining and using functions in console applications

  • Exchanging data with functions via return values and parameters

  • Passing parameter arrays to functions

  • Passing values by reference or by value

  • Specifying parameters for additional return values

  • The concept of variable scope, where variables can be hidden from sections of code where they aren't required

  • Details of the Main() function, including command-line parameter usage

  • Using functions in struct types

  • Function overloading, where you can supply different parameters to the same function to get additional functionality

  • Delegates and how to dynamically select functions for execution at runtime

A knowledge of how to use functions is central to all of the programming you are likely to be doing in the future. In later chapters, particularly when you learn about OOP (from Chapter 8 onwards), you will learn a more formal structure for functions and how they apply to classes. From then on, you will find that the ability to abstract code into reusable blocks is possibly the most useful aspect of C# programming.




Beginning Visual C# 2005
Beginning Visual C#supAND#174;/sup 2005
ISBN: B000N7ETVG
EAN: N/A
Year: 2005
Pages: 278

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net