-----------------------------------------------------------

New Message on BDOTNET

-----------------------------------------------------------
From: Luttappi9
Message 4 in Discussion

Hi 

strings are reference types and they are passed by reference.


normally while u passing a string to a method, the copy of the reference will 
be passed

eg.
test()
{
  string s1 = "111";
  //now memory for "111" is got alloted and s is refering to        that memory 
location
  method(s1);
}

method(string s2)
{
    //now s  contains a 'copy of reference' which is still pointing       to 
"111"
    s2 = "2222";  
    //this is same as s2 = new string("222"); 
    //now  new memory area is located for "222" and
    s2 is now refering to location of "222"
}

here the important point to note is 
s2 = "222" is same as s2=new string("222");
which is totaly reinitializing the string.

If u pass reference by reference, ie. method(ref string s2),
we will get the reference itself inside method()
and if u reinitialize the string then the original reference will get updated


bineesh av

-----------------------------------------------------------

To stop getting this e-mail, or change how often it arrives, go to your E-mail 
Settings.
http://groups.msn.com/bdotnet/_emailsettings.msnw

Need help? If you've forgotten your password, please go to Passport Member 
Services.
http://groups.msn.com/_passportredir.msnw?ppmprop=help

For other questions or feedback, go to our Contact Us page.
http://groups.msn.com/contact

If you do not want to receive future e-mail from this MSN group, or if you 
received this message by mistake, please click the "Remove" link below. On the 
pre-addressed e-mail message that opens, simply click "Send". Your e-mail 
address will be deleted from this group's mailing list.
mailto:[EMAIL PROTECTED]

Reply via email to