软泡芙 2022-11-25 09:05 采纳率: 50%
浏览 19
已结题

C# new StringValues this[string key]{ get; set; }是啥意思

代码位于卫浴IFormFile里的Headers(IHeaderDictionary)里,下面是两个接口的代码

    new StringValues this[string key]
    {
        get;
        set;
    }                     不懂这代码的写法,表达的意思,此代码位于IHeaderDictionary代码的最底部

IFormFile

using System.IO;
using System.Threading;
using System.Threading.Tasks;

namespace Microsoft.AspNetCore.Http
{
    //
    // 摘要:
    //     Represents a file sent with the HttpRequest.
    public interface IFormFile
    {
        //
        // 摘要:
        //     Gets the raw Content-Disposition header of the uploaded file.
        string ContentDisposition
        {
            get;
        }

        //
        // 摘要:
        //     Gets the raw Content-Type header of the uploaded file.
        string ContentType
        {
            get;
        }

        //
        // 摘要:
        //     Gets the file name from the Content-Disposition header.
        string FileName
        {
            get;
        }

        //
        // 摘要:
        //     Gets the header dictionary of the uploaded file.
        IHeaderDictionary Headers
        {
            get;
        }

        //
        // 摘要:
        //     Gets the file length in bytes.
        long Length
        {
            get;
        }

        //
        // 摘要:
        //     Gets the form field name from the Content-Disposition header.
        string Name
        {
            get;
        }

        //
        // 摘要:
        //     Copies the contents of the uploaded file to the target stream.
        //
        // 参数:
        //   target:
        //     The stream to copy the file contents to.
        void CopyTo(Stream target);

        //
        // 摘要:
        //     Asynchronously copies the contents of the uploaded file to the target stream.
        //
        // 参数:
        //   target:
        //     The stream to copy the file contents to.
        //
        //   cancellationToken:
        Task CopyToAsync(Stream target, CancellationToken cancellationToken = default(CancellationToken));

        //
        // 摘要:
        //     Opens the request stream for reading the uploaded file.
        Stream OpenReadStream();
    }
}

IHeaderDictionary

using Microsoft.Extensions.Primitives;
using System.Collections;
using System.Collections.Generic;

namespace Microsoft.AspNetCore.Http
{
    //
    // 摘要:
    //     Represents HttpRequest and HttpResponse headers
    public interface IHeaderDictionary : ICollection<KeyValuePair<string, StringValues>>, IEnumerable<KeyValuePair<string, StringValues>>, IEnumerable, IDictionary<string, StringValues>
    {
        //
        // 摘要:
        //     Strongly typed access to the Content-Length header. Implementations must keep
        //     this in sync with the string representation.
        long? ContentLength
        {
            get;
            set;
        }

        //
        // 摘要:
        //     IHeaderDictionary has a different indexer contract than IDictionary, where it
        //     will return StringValues.Empty for missing entries.
        //
        // 参数:
        //   key:
        //
        // 返回结果:
        //     The stored value, or StringValues.Empty if the key is not present.
        new StringValues this[string key]
        {
            get;
            set;
        }
    }
}
  • 写回答

1条回答 默认 最新

报告相同问题?

问题事件

  • 已结题 (查看结题原因) 12月2日
  • 已采纳回答 11月28日
  • 创建了问题 11月25日

悬赏问题

  • ¥15 MATLAB怎么通过柱坐标变换画开口是圆形的旋转抛物面?
  • ¥15 寻一个支付宝扫码远程授权登录的软件助手app
  • ¥15 解riccati方程组
  • ¥15 display:none;样式在嵌套结构中的已设置了display样式的元素上不起作用?
  • ¥15 使用rabbitMQ 消息队列作为url源进行多线程爬取时,总有几个url没有处理的问题。
  • ¥15 Ubuntu在安装序列比对软件STAR时出现报错如何解决
  • ¥50 树莓派安卓APK系统签名
  • ¥65 汇编语言除法溢出问题
  • ¥15 Visual Studio问题
  • ¥20 求一个html代码,有偿