JavaScriptEncoder.Create Method

Definition

Overloads

Create(TextEncoderSettings)

Creates a new instance of JavaScriptEncoder class with the specified settings.

Create(UnicodeRange[])

Creates a new instance of the JavaScriptEncoder class that specifies characters the encoder is allowed to not encode.

Create(TextEncoderSettings)

Source:
JavaScriptEncoder.cs
Source:
JavaScriptEncoder.cs
Source:
JavaScriptEncoder.cs
Source:
JavaScriptEncoder.cs

Creates a new instance of JavaScriptEncoder class with the specified settings.

C#
public static System.Text.Encodings.Web.JavaScriptEncoder Create(System.Text.Encodings.Web.TextEncoderSettings settings);

Parameters

settings
TextEncoderSettings

Settings that control how the JavaScriptEncoder instance encodes, primarily which characters to encode.

Returns

A new instance of the JavaScriptEncoder class.

Exceptions

settings is null.

Applies to

.NET 10 and other versions
Product Versions
.NET Core 1.0, Core 1.1, Core 3.0, Core 3.1, 5, 6, 7, 8 (package-provided), 8, 9 (package-provided), 9, 10 (package-provided), 10
.NET Standard 2.0 (package-provided)

Create(UnicodeRange[])

Source:
JavaScriptEncoder.cs
Source:
JavaScriptEncoder.cs
Source:
JavaScriptEncoder.cs
Source:
JavaScriptEncoder.cs

Creates a new instance of the JavaScriptEncoder class that specifies characters the encoder is allowed to not encode.

C#
public static System.Text.Encodings.Web.JavaScriptEncoder Create(params System.Text.Unicode.UnicodeRange[] allowedRanges);

Parameters

allowedRanges
UnicodeRange[]

The set of characters that the encoder is allowed to not encode.

Returns

A new instance of the JavaScriptEncoder class.

Exceptions

allowedRanges is null.

Remarks

Some characters in allowedRanges might still be encoded; that is, this parameter indicates what ranges the encoder is allowed to not encode, not what characters it must not encode.

Applies to

.NET 10 and other versions
Product Versions
.NET Core 1.0, Core 1.1, Core 3.0, Core 3.1, 5, 6, 7, 8 (package-provided), 8, 9 (package-provided), 9, 10 (package-provided), 10
.NET Standard 2.0 (package-provided)