Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
ByRef argument acting like a ByVal
Message
De
13/05/2011 09:19:12
 
 
À
12/05/2011 17:51:41
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Versions des environnements
Environment:
VB 9.0
Divers
Thread ID:
01510491
Message ID:
01510572
Vues:
41
>>>>I have a method that have the last few arguments being passed by reference (ByRef). But after the methods ends, the value returned do not have the changes applied by the methods. What would cause a string to be passed as though it was by value and not by reference. ( There are other methods with arguments being passed by reference and they work fine - I think).
>>>
>>>
>>>See the discussion here. String is an immutable reference type.
>>
>>Ok, do you have a link?
>
>
>Sorry Greg, I was late for a meeting.
>
>Here it is
>
>http://stackoverflow.com/questions/3655984/why-is-string-a-reference-type

Thanks

But it does not explain what I was observing. Only one of the methods was changing the ByRef arguments to a ByVal behaivor. I am doing this because several of the string arguments get altered, and I need the results upon return from the method(s). This may not good programming habit, but it was result after refractoring the parent method.

I resolved the problem (for now) by moving the child methods code back to the parent.
Greg Reichert
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform