B
Brad Wood
I have a method that takes a ref string parameter. This is because it
will be called in loops and most of the time it will not need to modify
the paramater at all, so I preferred not to return a newly allocated
string object.
I need to pass items of an array list (can't use specialized collection
in compact framework) to this method. I can't pass the array item
directly because I get a compiler error (a ref or out argument must be
an lvalue). So this is what I'm doing:
string temp = (string)array;
obj.refMethod ( ref temp );
array = temp;
I didn't find a performance problem with this, but is there a better way
to write this?
will be called in loops and most of the time it will not need to modify
the paramater at all, so I preferred not to return a newly allocated
string object.
I need to pass items of an array list (can't use specialized collection
in compact framework) to this method. I can't pass the array item
directly because I get a compiler error (a ref or out argument must be
an lvalue). So this is what I'm doing:
string temp = (string)array;
obj.refMethod ( ref temp );
array = temp;
I didn't find a performance problem with this, but is there a better way
to write this?