Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Value versus Reference
Message
 
 
À
13/09/2010 13:48:09
Timothy Bryan
Sharpline Consultants
Conroe, Texas, États-Unis
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Versions des environnements
Environment:
C# 3.0
Divers
Thread ID:
01481001
Message ID:
01481005
Vues:
37
>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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform