Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Passing dataset by reference
Message
De
12/03/2012 12:56:51
 
 
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Versions des environnements
Environment:
C# 2.0
Divers
Thread ID:
01538045
Message ID:
01538071
Vues:
35
>What if I passed the ds to the MyClass.MyMethod (without the Out parameter) and inside this method called adapter Fill() method with this dataset, would .NET fill the new instance of the dataset or the one created in the calling routine?

There's no new instance if you don't create one! If all you do is Fill, then it's filling the passed in reference and you're good. Also, with DataSets, if you wanted to start with a "clean" DataSet, rather than creating the new one, you could just execute the .Clear() method.
MyMethod(DataSet ds)
{
    // clear it if you want to start with an empty DataSet
    // ds.Clear();
    Adapter.Fill(ds)
}
Bonnie Berent DeWitt
NET/C# MVP since 2003

http://geek-goddess-bonnie.blogspot.com
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform