out int code example
Example 1: out parameters c#
int initializeInMethod;
OutArgExample(out initializeInMethod);
Console.WriteLine(initializeInMethod); // value is now 44
void OutArgExample(out int number)
{
number = 44;
}
Example 2: passing _ as out variable c#
What is _ in C#?
The underscore character ( _ ) is used to indicate that the parameter
should be ignored. It's like it is the write-only parameter.
It's also allowed to discard a variable type.
Discards could be used to ignore more parameters at once.