Https://learn.microsoft.com/en-us/dotnet/api/microsoft.aspnetcore.http.ibroverfile.openreadstream?view = aspnetcore-5.0#micrososoft_aspnet_aspnetcore_http_http_http_http_ibortfile_openreadstrearearreampreamstreamseam
每次称为def the the the the the the the the the the new
using
每次称为:
Https://github.com/dotnet/aspnetcore/blob/033b1fb1cf681ea95d3954c08e4391c93cd72683/src/src/src/httppppp /http/http/src/src/src/src/formfile.cs.cs-cs,utl811,—
FormFile
基本上是一个no-op。Https://github.com/dotnet/aspnetcore/blob/033b1fb1cf681ea95d3954c08e4391c93cd72683/src/src/htttp/httpp/
考虑到这一点,不需要处理。 但是处理它也不会伤害任何事情。
ReferenceReadStream
不会创建新的“流”;但是,它确实创建了一个新的OpenReadStream()
,其中基础流被重复使用。我会使用
ReferenceReadStream
,因为Dispose
没有实现,然后关闭流。
IFormFile.OpenReadStream()
Https://github.com/dotnet/aspnetcore/blob/033b1fb1cf681ea95d3954c08e4391c93cd72683/src/src/src/httppppp /http/http/src/src/src/src/formfile.cs.cs-cs,utl811,—
我的2cts在这里:此页面上的答案和评论似乎很集中在默认实现的方面。tl; dr:我建议使用
OpenReadStream()
语句或块包装aLways,如果只是因为有一天它可能是唯一要做的事情