ex-21-17
来自「Programming Csharp Source Code(代码) Prog」· 代码 · 共 44 行
TXT
44 行
// 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 + =
减小字号Ctrl + -
显示快捷键?