var savePath = Path.Combine(StoragePath, "test.png");
string directory = Path.GetDirectoryName(savePath);
if (!Directory.Exists(directory))
{
Directory.CreateDirectory(directory);
}
using (var fileStream = new FileStream(savePath, FileMode.Create))
{
await myObject.Image.CopyToAsync(fileStream);
}
var savePath = Path.Combine(StoragePath, "test.png");
string directory = Path.GetDirectoryName(savePath);
if (!Directory.Exists(directory))
{
Directory.CreateDirectory(directory);
}
using (var fileStream = new FileStream(savePath, FileMode.Create))
{
await myObject.Image.CopyToAsync(fileStream);
}