Method Parameters (C# Reference)

Parameters declared for a method without in, ref or out, are passed to the called method by value. That value can be changed in the method, but the changed value will not be retained when control passes back to the calling procedure. By using a method parameter keyword, you can change this behavior.

This section describes the keywords you can use when declaring method parameters:

  • params specifies that this parameter may take a variable number of arguments.

  • in specifies that this parameter is passed by reference but is only read by the called method.

  • ref specifies that this parameter is passed by reference and may be read or written by the called method.

  • out specifies that this parameter is passed by reference and is written by the called method.

See Also