Skip to content

不要关闭用户的stream #266

@p3p3pp3

Description

@p3p3pp3

请不要关闭用户的stream,上传可能并非是最后一个动作,用户的流后续还要使用,应遵从谁创建、谁关闭的原则。

public HttpResult UploadStream(Stream stream, string key, string token, PutExtra putExtra)
{
//省略...
    using (stream)
    {
    }
}

当然,为了兼容性处理,建议增加默认参数:

public HttpResult UploadStream(Stream stream, string key, string token, PutExtra putExtra, bool closeStreamAfterUpload = true)
{
//省略...
try
{
}
finally
{
    if(closeStreamAfterUpload) stream.Dispose();
}
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions