HtmlString Class

An Microsoft.AspNetCore.Html.IHtmlContent implementation that wraps an HTML encoded System.String.

Namespace
Microsoft.AspNetCore.Html
Assemblies
  • Microsoft.AspNetCore.Html.Abstractions

Syntax

public class HtmlString : IHtmlContent
class Microsoft.AspNetCore.Html.HtmlString

Constructors

HtmlString(System.String)

Creates a new Microsoft.AspNetCore.Html.HtmlString.

Arguments:value (System.String) – The HTML encoded value.
public HtmlString(string value)

Methods

ToString()
Return type:System.String
public override string ToString()
WriteTo(System.IO.TextWriter, System.Text.Encodings.Web.HtmlEncoder)
public void WriteTo(TextWriter writer, HtmlEncoder encoder)

Fields

Empty()

An Microsoft.AspNetCore.Html.HtmlString instance for System.String.Empty.

Return type:Microsoft.AspNetCore.Html.HtmlString
public static readonly HtmlString Empty
NewLine()

An Microsoft.AspNetCore.Html.HtmlString instance for System.Environment.NewLine.

Return type:Microsoft.AspNetCore.Html.HtmlString
public static readonly HtmlString NewLine

Properties

Microsoft.AspNetCore.Html.HtmlString.Value

Gets the HTML encoded value.

Return type:System.String
public string Value { get; }