blazor 读取txt

1

2

3

 

@page "/"
@inject HttpClient http

<h1>Hello, world!</h1>

<button @onclick="@do1">测试</button>

@code{
    public async void do1()
    {
        using var response = await http.GetAsync("22.txt");
        using var stream = await response.Content.ReadAsStreamAsync();

        StreamReader sr = new StreamReader(stream);
        var str = sr.ReadToEnd();


        Console.WriteLine(str);
    }
}

blazor 读取txt

 

 blazor 读取txt

 

blazor 读取txt

上一篇:【ybtoj】新的开始


下一篇:Erlang聊天室