可以使用以下代码将 Base64 数据下载到本地:

using System;
using System.IO;

public class Program
{
    public static void Main(string[] args)
    {
        string base64Data = 'Your base64 data here';
        string filePath = 'C:\path\to\save\file.txt';

        byte[] fileBytes = Convert.FromBase64String(base64Data);
        File.WriteAllBytes(filePath, fileBytes);

        Console.WriteLine('File saved successfully.');
    }
}

请将base64Data替换为您要下载的 Base64 数据,将filePath替换为您要保存文件的路径。然后运行代码,它将把 Base64 数据转换为字节数组,并将字节数组写入指定的文件路径。最后,它会在控制台输出'File saved successfully.'表示文件保存成功。

C# 将 Base64 数据下载到本地 - 代码示例

原文地址: https://www.cveoy.top/t/topic/qiqh 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录