using
variables are treated as readonly, as any reassignment is probably an error. Since ref
allows reassignment, this would also be an issue. At the IL level, out
is pretty-much identical to ref
.
However, I doubt you need ref
here; you are already passing a reference to the form, since it is a class. For reference-types, the main purpose of a ref
would be to allow you to reassign the variable, and have the caller see the reassignment, i.e.
void doSomething(ref Form form)
{
form = null; // the caller will see this change
}
it is not required if you are just talking to the form object:
void doSomething(Form form)
{
form.Text = "abc"; // the caller will see this change even without ref
}
since it is the same form object.