TypedResults.Text Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
Text(ReadOnlySpan<Byte>, String, Nullable<Int32>) |
Writes the |
Text(String, String, Encoding) |
Writes the This is an alias for Content(String, String, Encoding). |
Text(String, String, Encoding, Nullable<Int32>) |
Writes the This is an alias for Content(String, String, Encoding, Nullable<Int32>). |
Text(ReadOnlySpan<Byte>, String, Nullable<Int32>)
- Source:
- TypedResults.cs
Writes the utf8Content
UTF8 text content to the HTTP response.
public static Microsoft.AspNetCore.Http.HttpResults.Utf8ContentHttpResult Text (ReadOnlySpan<byte> utf8Content, string? contentType = default, int? statusCode = default);
static member Text : ReadOnlySpan<byte> * string * Nullable<int> -> Microsoft.AspNetCore.Http.HttpResults.Utf8ContentHttpResult
Public Shared Function Text (utf8Content As ReadOnlySpan(Of Byte), Optional contentType As String = Nothing, Optional statusCode As Nullable(Of Integer) = Nothing) As Utf8ContentHttpResult
Parameters
- utf8Content
- ReadOnlySpan<Byte>
The content to write to the response.
- contentType
- String
The content type (MIME type).
Returns
The created Utf8ContentHttpResult object for the response.
Applies to
Text(String, String, Encoding)
- Source:
- TypedResults.cs
Writes the content
string to the HTTP response.
This is an alias for Content(String, String, Encoding).
public static Microsoft.AspNetCore.Http.HttpResults.ContentHttpResult Text (string? content, string? contentType, System.Text.Encoding? contentEncoding);
static member Text : string * string * System.Text.Encoding -> Microsoft.AspNetCore.Http.HttpResults.ContentHttpResult
Public Shared Function Text (content As String, contentType As String, contentEncoding As Encoding) As ContentHttpResult
Parameters
- content
- String
The content to write to the response.
- contentType
- String
The content type (MIME type).
- contentEncoding
- Encoding
The content encoding.
Returns
The created ContentHttpResult object for the response.
Remarks
If encoding is provided by both the 'charset' and the contentEncoding
parameters, then the contentEncoding
parameter is chosen as the final encoding.
Applies to
Text(String, String, Encoding, Nullable<Int32>)
- Source:
- TypedResults.cs
Writes the content
string to the HTTP response.
This is an alias for Content(String, String, Encoding, Nullable<Int32>).
public static Microsoft.AspNetCore.Http.HttpResults.ContentHttpResult 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.HttpResults.ContentHttpResult
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 ContentHttpResult
Parameters
- content
- String
The content to write to the response.
- contentType
- String
The content type (MIME type).
- contentEncoding
- Encoding
The content encoding.
Returns
The created ContentHttpResult object for the response.
Remarks
If encoding is provided by both the 'charset' and the contentEncoding
parameters, then the contentEncoding
parameter is chosen as the final encoding.