c# - Large sized string by ref or value? -
i understand string sent value though reference type, if string tens of mb in size , wanted send argument.
should send reference or value?
private int getindexofnext(string string,int searchstartindex,char targetchar)
or
private int getindexofnext(ref string string,int searchstartindex,char targetchar)
i understand string sent value though reference type
for strings or other reference types, address passed value. not value gets passed, case doesn't matter. reason parameter passing involving strings looks different because strings immutable (and when try modify string's content).
you should see: parameter passing in c# jon skeet
Comments
Post a Comment