Click here to Skip to main content
15,892,537 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
if i am passing a string to a function as parameter then it is passing as reference..Because it is reference type.

But if i am changing the value of the string in the function then it is not getting changed, because it is immutable(i got the answer like this)...

so normally when we want to pass a string as param, we never want to pass as reference..because it is already a reference...

but if i am trying to send the string as 'ref' then the value is getting changed...

How it is working.. because string is already a reference ??
Posted

Hi,

This link will Help u lot
http://msdn.microsoft.com/en-us/library/s6938f28(v=vs.80).aspx[^]

best Luck
happy Coding
 
Share this answer
 
Comments
VJ Reddy 11-Apr-12 4:19am    
Good link. +5
C# has out (or ref, depending on your needs) keyword for that, see: "out parameter modifier (C# Reference)"[^].
 
Share this answer
 
v4
Comments
VJ Reddy 11-Apr-12 5:11am    
Nice addition. +5
CPallini 11-Apr-12 5:18am    
Thank you.
Espen Harlinn 11-Apr-12 7:40am    
5'ed!
CPallini 11-Apr-12 8:03am    
Thank you.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900