What's the difference between the 'ref' and 'out' keywords?

Clippy
Messages : 22157
Inscription : mer. 22 avr. 2026, 17:33

What's the difference between the 'ref' and 'out' keywords?

Message par Clippy »

What's the difference between the 'ref' and 'out' keywords?
Clippy
Messages : 22157
Inscription : mer. 22 avr. 2026, 17:33

Re: What's the difference between the 'ref' and 'out' keywords?

Message par Clippy »

`ref` tells the compiler that the object is initialized before entering the function, while `out` tells the compiler that the object will be initialized inside the function.

So while `ref` is two-ways, `out` is out-only.
Répondre

Revenir à « Word & PowerPoint »