Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Value versus Reference
Message
 
 
To
13/09/2010 13:48:09
Timothy Bryan
Sharpline Consultants
Conroe, Texas, United States
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Environment versions
Environment:
C# 3.0
Miscellaneous
Thread ID:
01481001
Message ID:
01481005
Views:
38
>Hi,
>
>If I want to store a value retrieved for later and it is a reference type value, how can I convert this to a value? Here is what I mean.
>
>
>DataSet dsSmith = this.oContact.GetContactByLastName("Smith");
>Session["dsSmith"] = dsSmith
>
>DataSet dsMiller = this.oContact.GetContactByLastName("Miller");
>Session["dsMiller"] = dsMiller;
>
>// Get the dataset back from the session
>DataSet dsGetSmith = (DataSet)Session["dsSmith"];
>
>DataSet dsGetMiller = (DataSet)Session["dsMiller"];
>
>// Both dsGetSmith & dsGetMiller have the exact same dataset.
>
>
>When the first dataset is retrieved and saved in the session the value is as expected. When the second dataset is retrieved the first dataset that was saved is replaced because it was a reference. How can I copy a dataset to a value so it does not get a reference update?
>Thanks
>Tim

I think there is CopyDS or something like this, although I'm not sure I understand how did you end up with the same dataset.
If it's not broken, fix it until it is.


My Blog
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform