Lecture overview -- Keyboard shortcut: 'u'  Previous page: Local variables in methods -- Keyboard shortcut: 'p'  Next page: Value Parameters -- Keyboard shortcut: 'n'  Lecture notes - all slides and notes together  slide -- Keyboard shortcut: 't'  Textbook -- Keyboard shortcut: 'v'  Help page about these notes  Alphabetic index  Course home  Page 20 : 29
Object-oriented Programming in C#
Data Access, Properties, and Methods
Parameters

On this page we will review the basic concepts of method parameters: formal parameters and actual parameters. We will also enumerate the different kinds of parameter passing modes.

Actual parameters occur in a call. Formal parameters occur in the method declaration. In general, actual parameters are expressions which are evaluated to arguments. Depending on the kind of parameters, the arguments are somehow associated with the formal parameters.

 

  • There are four different kinds of formal parameters in C#:

    • Value parameters

      • The default parameter passing mode, without use of a modifier

    • Reference parameters

      • Specified with the ref modifier

    • Output parameters

      • Specified with the out modifier

    • Parameter arrays

      • Value parameters specified with the params modifier

The parameter passing modes.

Read more about parameters in the text book version of this material.