Answers for "c# is file closed"

C#
0

c# is file closed

private async Task<Stream> GetStreamAsync()
{
    try
    {
        return new FileStream("sample.mp3", FileMode.Open, FileAccess.Write);
    }
    catch (IOException)
    {
        await Task.Delay(TimeSpan.FromSeconds(1));
        return await GetStreamAsync();
    }
}
Posted by: Guest on April-26-2021
0

c# is file closed

using (var stream = await FileStreamGetter.GetStreamAsync())
{
    Console.WriteLine(stream.Length);
}
Posted by: Guest on April-26-2021

Code answers related to "c# is file closed"

C# Answers by Framework

Browse Popular Code Answers by Language