Geeks With Blogs
finally{} My interactions with .Net and Web development - What's most important is what happens finally{} June 2005 Entries
Value types/Reference types - pass by value/reference analysis
This is an programmatic anlaysis of Value types and Reference types passed by value and reference with newing the object inside the method. Read the conclusions for a clear cut understanding of this apparent confusing funda. //Value types 'pass by' analysis. // 1. Pass by reference, new obj inside the method. string str = "abc"; modifyStr1(ref str); MessageBox.Show(str); // outputs "x" // 2. Pass by reference, no new obj inside the method. str = "abc"; modifyStr2(ref str); MessageBox.Show(str);// ......

Posted On Thursday, June 2, 2005 1:28 PM

Copyright © Vinayak | Powered by: GeeksWithBlogs.net