Lecture overview -- Keyboard shortcut: 'u'  Previous page: Parameters -- Keyboard shortcut: 'p'  Next page: Passing references as 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 21 : 29
Object-oriented Programming in C#
Data Access, Properties, and Methods
Value Parameters

Value parameters are - by far - the most frequently used parameters of methods in C#.

Value parameters are used for input to methods

  • Value parameter passing:

    • A formal parameter corresponds to a local variable

    • A formal parameter is initialized by the corresponding argument (the value of the actual parameter expression)

      • A copy of the argument is bound to the formal parameter

    • Implicit conversions may take place

    • A formal parameter is assignable, but with no effect outside the method

How value parameters work.

/user/normark/oop-csharp-1/sources/c-sharp/bank-account/bank-account-properties/bank-account-1.csMethods with value parameters in class BankAccount.

Assignments to a formal value parameter do not affect the corresponding actual parameter

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