Here’s my method:
public static bool ValidateAddressCount(ref long o_addressCount)
{
// o_addressCount is modified here
//return true or false
}
I’ve reached some case when i don’t care what the method returns, i just need the o_adressCount
Is it a good practice to use this method in the following way:
long addressCount = 0;
ValidateAddressCount(ref addressCount); //without assigning the returned value to any variable
//use address count
Also, can anyone explain why this works in .net?
Thank you
Why it works is easy:
is of the same form as
Any
<expression> ;is a valid statement.There is a valid question here though:
Because in general it is not a good practice to ignore a return value.