Mapa mental
C# - Parameters
Contenido del mapa
C# - Parameters
Parameters are used to pass values or variable references to methods. The parameters of a method get their actual values from the arguments that are specified when the method is invoked. There are four kinds of parameters: value parameters, reference parameters, output parameters, and parameter arrays.
Value Parameters
- A value parameter is used for passing input arguments. A value parameter corresponds to a local variable that gets its initial value from the argument that was passed for the parameter. Modifications to a value parameter don't affect the argument that was passed for the parameter.
Reference Parameters
- A reference parameter is used for passing arguments by reference. The argument passed for a reference parameter must be a variable with a definite value. During the execution of the method, the reference parameter represents the same storage location as the argument variable. A reference parameter is declared with the ref modifier.
Output Parameters
- An output parameter is used for passing arguments by reference. It's similar to a reference parameter, except that it doesn't require that you explicitly assign a value to the caller-provided argument. An output parameter is declared with the out modifier.
Parameter Arrays
- A parameter array permits a variable number of arguments to be passed to a method. A parameter array is declared with the params modifier. Only the last parameter of a method can be a parameter array, and the type of a parameter array must be a single-dimensional array type.
Información
- Descripción
- Mapa Mental sobre C# - Parameters, creado por Lucas Gomes el 29/04/2021.
- Creado por
- Lucas Gomes
- Visitas
- 0
- Valoración