Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis+ 5
What's the difference between ref and out in C# ?
C#
3 Respostas
+ 5
rel isĀ used to state that the parameter passed may be modified by the method. inĀ isĀ used to state that the parameter passed cannot be modified by the method.
Ā Out isĀ used to state that the parameter passed must be modified by the method.
+ 3
ref is
may be modified by method
out is
must be modified by method
in is
cannot be modified by the method.
+ 2
Variables passed by `ref` specifier need to be initialized before they can be used e.g. passing them to a method.
Variables passed by `out` specifier are not necessarily be initialized before they can be used e.g. passing them to a method.
https://www.dotnettricks.com/learn/csharp/difference-between-ref-and-out-parameters