Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

Whats the difference between the ref and out modifiers on parameters?

modifiers parameters REF
0
Posted

Whats the difference between the ref and out modifiers on parameters?

0

Both the ref and out modifiers are applied to arguments of a method and both mean that the argument will be passed “by reference” (either a value type variable by reference or a reference type variable by reference). The out parameter, however, allows you to pass in an uninitialized variable like so and guarantees it will come back with its value set (so long as the called method was written in C#, anyway).

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.

Experts123