Sometimes we need to more than one value from function. In C# we can use either of three approaches:
- Using output parameters
- Using array
- Using structs
In our example we have an array, in which we have to find min, max, and sum of all its elements, means we need to multiple return value from a method.
Using output parameters:
We could use output parameters to get multiple value return from method. In method that take output parameters (via out keyword),we must assign appropriate value before exiting the method scope. (if we fail to do so, we will receive compiler errors).
we can use a array to get multiple value from method.