403
C# Out Parameter
C# provides out keyword to pass arguments as out-type. It is like reference-type, except that it does not require variable to initialize before passing. We must use out keyword to pass argument as out-type. It is useful when we want a function to return multiple values.
C# Out Parameter Example 1
Output:
Value before passing out variable 50 Value after receiving the out variable 25
The following example demonstrates that how a function can return multiple values.
C# Out Parameter Example 2
Output:
Value before passing val1 = 50 val2 = 100 Value after passing val1 = 25 val2 = 25
Next TopicC# Arrays