更改文本文件扩展名并阅读 [英] Change a text file extension and read it

查看:80
本文介绍了更改文本文件扩展名并阅读的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我有一个文本文件,并且更改了扩展名,例如".data",我可以将c#中的文本转换为类似于".txt"的格式?

If i have a text file and i change the extension in something like ".data" i can convert that text in c# to can be read like ".txt"?

推荐答案

  可以使用 File.ReadAllText(@"C:\ MyFile.data")读取文本文件, 等.即使扩展名不是 ". txt" .

  A text file can be read using File.ReadAllText(@"C:\MyFile.data"), etc. even if the extension is not ".txt".


这篇关于更改文本文件扩展名并阅读的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆