Pergunta

I have some void methods which are static.

Is it better to pass variables by reference or by value, because I'm passing large amount of text into these variables :

public static void renderText(ref StringBuilder build)
{
  //Do your job.
}

So could someone explain me, what happens when I send a reference of StringBuilder, does it only access this StringBuilder? (It does not copy it right!).

And just in case I'm not changing the value or any other property of input arguments into methods.

So, in this cases where variables are huge enough and not manipulated, should I always send the reference of it, and if yes does it interfere with something?

Nenhuma solução correta

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top