c# - 在 C# 中创建文件 (.htm)

标签 c# file

我想知道使用 C# 创建简单 html 文件的最佳方法。

它是否使用类似 System.IO.File.Create 的东西?

最佳答案

有点像-

using (FileStream fs = new FileStream("test.htm", FileMode.Create)) 
{ 
    using (StreamWriter w = new StreamWriter(fs, Encoding.UTF8)) 
    { 
        w.WriteLine("<H1>Hello</H1>"); 
    } 
} 

关于c# - 在 C# 中创建文件 (.htm),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7804255/

相关文章:

c# - ILogger 的隐式范围

Java:CSV文件读写

c# - CloudTableClient 单元测试

c# - TransactionScope 提前完成

c# - OpenXML 读取 CustomXMLPart

php - 如何检查是否在 php 中设置了 $FILE?

php - 使用 html5 分块上传文件

c# - C#中不用foreach直接获取dictionary<int, object>第一个key

file - 如何检查文件是否存在于 makefile 中

java - 可运行的 jar,将参数传递给 jar 中的文件