Can anyone tell me which one is lighter between ref and out. I know the exact difference between ref and out keyword and usage as well.
In my case I can use both ref and out, but wondering the lighter one.
If some one needs to refer please go here and let me know the lighter ones.
Thanks in advance..
The only difference is a compiler hint.
… out …
… ref …
…
outandrefare effectively the same. The only real difference being that out tells the compiler to expect the value to be set before the method is returned. You could send a value to a function that has anoutflag but again the compiler will treat it as an unassigned variable. The runtime doesn’t really care. Both will be created as a pointer to the variable. You are best to use the keyword that describes the functionality you expect with your function. Any optimization that “may” take place in the JITer below this will have near 0 impact on the application.