Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Valid way to use using
Message
From
21/11/2008 10:28:18
Timothy Bryan
Sharpline Consultants
Conroe, Texas, United States
 
 
To
All
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Title:
Valid way to use using
Environment versions
Environment:
C# 3.0
OS:
Windows XP SP2
Application:
Desktop
Miscellaneous
Thread ID:
01363486
Message ID:
01363486
Views:
54
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
Next
Reply
Map
View

Click here to load this message in the networking platform