Results.Text 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
重载
Text(ReadOnlySpan<Byte>, String, Nullable<Int32>) |
将 |
Text(String, String, Encoding) |
将 |
Text(String, String, Encoding, Nullable<Int32>) |
将 |
Text(ReadOnlySpan<Byte>, String, Nullable<Int32>)
- Source:
- Results.cs
将 utf8Content
UTF-8 编码的文本写入 HTTP 响应。
public static Microsoft.AspNetCore.Http.IResult Text (ReadOnlySpan<byte> utf8Content, string? contentType = default, int? statusCode = default);
static member Text : ReadOnlySpan<byte> * string * Nullable<int> -> Microsoft.AspNetCore.Http.IResult
Public Shared Function Text (utf8Content As ReadOnlySpan(Of Byte), Optional contentType As String = Nothing, Optional statusCode As Nullable(Of Integer) = Nothing) As IResult
参数
- utf8Content
- ReadOnlySpan<Byte>
要写入到响应的内容。
- contentType
- String
内容类型(MIME 类型)。
返回
为响应创建的 IResult 对象。
适用于
Text(String, String, Encoding)
- Source:
- Results.cs
将 content
字符串写入 HTTP 响应。
public static Microsoft.AspNetCore.Http.IResult Text (string content, string? contentType = default, System.Text.Encoding? contentEncoding = default);
public static Microsoft.AspNetCore.Http.IResult Text (string? content, string? contentType, System.Text.Encoding? contentEncoding);
static member Text : string * string * System.Text.Encoding -> Microsoft.AspNetCore.Http.IResult
Public Shared Function Text (content As String, Optional contentType As String = Nothing, Optional contentEncoding As Encoding = Nothing) As IResult
Public Shared Function Text (content As String, contentType As String, contentEncoding As Encoding) As IResult
参数
- content
- String
要写入到响应的内容。
- contentType
- String
内容类型(MIME 类型)。
- contentEncoding
- Encoding
内容编码。
返回
为响应创建的 IResult 对象。
注解
如果编码由“charset”和 contentEncoding
参数提供,则 contentEncoding
选择参数作为最终编码。
适用于
Text(String, String, Encoding, Nullable<Int32>)
- Source:
- Results.cs
将 content
字符串写入 HTTP 响应。
public static Microsoft.AspNetCore.Http.IResult Text (string? content, string? contentType = default, System.Text.Encoding? contentEncoding = default, int? statusCode = default);
static member Text : string * string * System.Text.Encoding * Nullable<int> -> Microsoft.AspNetCore.Http.IResult
Public Shared Function Text (content As String, Optional contentType As String = Nothing, Optional contentEncoding As Encoding = Nothing, Optional statusCode As Nullable(Of Integer) = Nothing) As IResult
参数
- content
- String
要写入到响应的内容。
- contentType
- String
内容类型(MIME 类型)。
- contentEncoding
- Encoding
内容编码。
返回
为响应创建的 IResult 对象。
注解
如果编码由“charset”和 contentEncoding
参数提供,则 contentEncoding
选择参数作为最终编码。