I'm having trouble grasping the value, ref, and out methods and how to use them. Could someone help explain it better? | Sololearn: Learn to code for FREE!
¡Nuevo curso! ¡Todo programador debería aprender IA Generativa!
Prueba una lección gratuita
0

I'm having trouble grasping the value, ref, and out methods and how to use them. Could someone help explain it better?

22nd Jul 2016, 10:27 PM
Daniel Hildreth
Daniel Hildreth - avatar
3 Respuestas
+ 1
ByVal is just like you borrow the book of you friend, then you copied for your self, after that you giving back that book to your friend so you can edit only the copy version of that book. ByRef is just like you borrow the book from your friend, then you edited directly, so not only you have that new version of that book, but also your friend later also got it when you giving back to your friend.
24th Jul 2016, 10:16 PM
Rezza Prayogi
Rezza Prayogi - avatar
0
'ref' signatures allow you to change a value you pass into it and the change persisting outside the function. 'out' is pretty much the same with minor differences. 'ref' uses initialized values, while 'out' does't need it to be initialized.
23rd Jul 2016, 2:40 AM
Darkrifts