ex-21-18

来自「Programming Csharp Source Code(代码) Prog」· 代码 · 共 43 行

TXT
43
字号
// Example 21-18: Reading from 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()
        {
            // open the configuration file stream
            IsolatedStorageFileStream configFile = 
                new IsolatedStorageFileStream
                ("Tester.cfg",FileMode.Open);

            // create a standard stream reader
            StreamReader reader = 
                new StreamReader(configFile);

            // read through the file and display
            string theEntry;
            do
            {
                theEntry = reader.ReadLine();
                Console.WriteLine(theEntry);
            } while (theEntry != null); 

            reader.Close();
            configFile.Close();
        }
    }
}

⌨️ 快捷键说明

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