Archived
1
0
This repository has been archived on 2026-03-24. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
SomeLab/16_3/Program.cs
2025-11-15 20:25:57 +08:00

27 lines
865 B
C#

using System;
using System.IO;
namespace _16_3
{
class Program
{
private const string FILE_NAME = @"c:\temp\TestFile.txt";
static void Main(string[] args)
{
using (StreamWriter sw = new StreamWriter(FILE_NAME))
{
sw.Write("文本文件");
sw.Write("的写入/读取");
sw.WriteLine("-----------------------");
sw.WriteLine("写入整数{0},或浮点数{1}", 1, 4.2);
bool b = false; char grade ='A'; string s = "Multiple Data Type!";
sw.WriteLine("写入布尔值、字符、字符串、日期:");
sw.WriteLine(b);
sw.WriteLine(grade);
sw.WriteLine(s);
sw.Write("当前日期:");sw.WriteLine(DateTime.Now);
}
}
}
}