Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Valid way to use using
Message
De
21/11/2008 10:28:18
Timothy Bryan
Sharpline Consultants
Conroe, Texas, États-Unis
 
 
À
Tous
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Titre:
Valid way to use using
Versions des environnements
Environment:
C# 3.0
OS:
Windows XP SP2
Application:
Desktop
Divers
Thread ID:
01363486
Message ID:
01363486
Vues:
52
Hi All,

Just checking, is this a valid way to use the using statement in this case? Is the StreamWriter closed and disposed?
private void RestoreDeleteList()
{
     string deleteListPath = AppDesktop.QueueDataPath + @"\DeleteList.xml";

     if (File.Exists(deleteListPath))
     {
          FileStream stream = null;
          XmlSerializer serializer = new XmlSerializer(typeof(List<string>));

          using (stream = File.Open(deleteListPath, FileMode.Open))
          {
               deleteFileList = (List<string>)serializer.Deserialize(stream);
          }
     }
}
Thanks
Tim
Timothy Bryan
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform