-----------------------------------------------------------
New Message on BDOTNET
-----------------------------------------------------------
From: nitin_karan
Message 2 in Discussion
Hi Mrinal, DataSet is always passed by reference. You can check that by passing the
DataSet and changing the values in it and without returning anything try accessing the
DataSet and you will find the changed version. However an imp point is passing DataSet
creates a new reference to the DataSet. Go through the example and you will find the
difference. It's the reference to the dataset that is passed by value not the
dataset itself.
Example
DataSet ds1 = new DataSet();
DoSomethingWith(ds1);
..
private void DoSomethingWith(DataSet passed)
{
// passed is a completely new reference pointing to the same DataSet as ds1
TweakData(passed);
// since passed points to the same dataset as ds1 the changes will be seen
when using ds1 too;
passed = new DataSet();
// now however passed points to something new
ClearEverything(passed);
// but ds1 still points to the old dataset and is not affected
}
If it was by reference ds1 would point to the new DataSet.
--Nitin
-----------------------------------------------------------
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]