System.IO.IsolatedStorage.IsolatedStorageFileStream.Dispose C# (CSharp) Méthode

Dispose() protected méthode

protected Dispose ( bool disposing ) : void
disposing bool
Résultat void
        protected override void Dispose(bool disposing) { }
        public override int EndRead(System.IAsyncResult asyncResult) { throw null; }

Usage Example

        private void MenuItem_Click(object sender, RoutedEventArgs e)
        {

            MenuItem menu = sender as MenuItem;
            string strTemp = menu.Tag.ToString();

            using (IsolatedStorageFile storage = IsolatedStorageFile.GetUserStoreForApplication())
            {
                try
                {
                    IsolatedStorageFileStream location;

                    location = new IsolatedStorageFileStream("favoriteRoutes.dat", System.IO.FileMode.Open, storage);
                    StreamReader sr = new StreamReader(location);
                    string content = sr.ReadToEnd();
                    sr.Close();
                    location.Dispose();
                    content = content.Replace(strTemp, "");

                    location = new IsolatedStorageFileStream("favoriteRoutes.dat", System.IO.FileMode.Truncate, storage);
                    StreamWriter sw = new StreamWriter(location);
                    sw.Write(content);
                    sw.Close();
                    location.Dispose();
                    
                }
                catch (Exception e1)
                {
                    Debug.WriteLine(e1.Message);
                }
            }

            llsFavRoutes.ItemsSource = null;
            BindData();
        }
All Usage Examples Of System.IO.IsolatedStorage.IsolatedStorageFileStream::Dispose