C# Base64 编码的字符串到文件

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/1588306/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-06 19:06:09  来源:igfitidea点击:

Base64 encoded string to file

c#encodingbase64

提问by JL.

I have a base64 encoded string.

我有一个 base64 编码的字符串。

How can I write this base64 encoded string to a file?

如何将此 base64 编码的字符串写入文件?

采纳答案by Rubens Farias

Try this:

尝试这个:

File.WriteAllBytes(@"c:\yourfile", Convert.FromBase64String(yourBase64String));

回答by flq

As a first pointer, check out MSDN's documentation on the XmlTextreader's ReadBase64Method... http://msdn.microsoft.com/en-us/library/system.xml.xmltextreader.readbase64.aspx

作为第一个指针,请查看有关XmlTextreaderReadBase64方法的MSDN 文档... http://msdn.microsoft.com/en-us/library/system.xml.xmltextreader.readbase64.aspx