The problem isn't with the ref
parameter. It's that ret
is an instance method, and you can't call an instance method without a reference to an instance of that type.
Try making ret
static:
public static void ret(ref int variable)
{
variable = 7;
}