[過去ログ] ふらっと C#,C♯,C#(初心者用) Part158 (1002レス)
上下前次1-新
抽出解除 必死チェッカー(本家) (べ) 自ID レス栞 あぼーん
このスレッドは過去ログ倉庫に格納されています。
次スレ検索 歴削→次スレ 栞削→次スレ 過去ログメニュー
425(1): (ワッチョイ 9354-ouLR) 2023/05/06(土)20:43 ID:8uPWyiyX0(1) AAS
非同期ファイルコピーのサンプルを探していたら、FileStream を使う方法と File.Copy を使う方法があるようなのですが、どっちがいいのでしょうか?
それぞれのメリット・デメリットが知りたいです。
//方法 1 (FileStream)
private static async Task CopyFileAsync(string sourceFilePath, string destinationFilePath)
{
using (var sourceStream = new FileStream(sourceFilePath, FileMode.Open, FileAccess.Read, FileShare.Read, bufferSize: 4096, true))
using (var destinationStream = new FileStream(destinationFilePath, FileMode.CreateNew, FileAccess.Write, FileShare.None, bufferSize: 4096, true))
{
await sourceStream.CopyToAsync(destinationStream);
}
省7
上下前次1-新書関写板覧索設栞歴
スレ情報 赤レス抽出 画像レス抽出 歴の未読スレ AAサムネイル
ぬこの手 ぬこTOP 0.044s