msdn documentation on out says that a parameter passed as out must be assigned a value inside the function. Example from the website:
class OutExample
{
static void Method(out int i)
{
i = 44;
}
static void Main()
{
int value;
Method(out value);
// value is now 44
}
}
According to my understanding when the int "value" is declared it is already assigned a default value of 0 (since int is a value type and cannot be null.) So why would it be necessary that "Method" modify its value?
Similarly, if "ref" were to be used instead of out, would there be any need of initializing "value"?
There are questions like this What's the difference between the 'ref' and 'out' keywords? but no one wants to put 2 and 2 together.