⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ex-21-17

📁 Programming Csharp Source Code(代码) Programming Csharp Source Code
💻
字号:
// Example 21-17: Writing to isolated storage

namespace Programming_CSharp
{
    using System;
    using System.IO;
    using System.IO.IsolatedStorage;

    public class Tester
    {

        public static void Main()
        {
            Tester app = new Tester();  
            app.Run();
        }

        private void Run()
        {
            // create the configuration file stream
            IsolatedStorageFileStream configFile = 
                new IsolatedStorageFileStream
                ("Tester.cfg",FileMode.Create);

            // create a writer to write to the stream
            StreamWriter writer = 
                new StreamWriter(configFile);

            // write some data to the config. file
            String output; 
            System.DateTime currentTime = System.DateTime.Now;
            output = "Last access: " + currentTime.ToString();
            writer.WriteLine(output);
            output = "Last position = 27,35";
            writer.WriteLine(output);

            // flush the buffer and clean up
            writer.Flush();
            writer.Close();
            configFile.Close();
        }
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -