Legend

Class
Struct
Enum
Interface
Delegate
Constructor
Method
Property
Event
Field

Extension method: string HtmlEscape(this string, bool, bool)

Declaration

public static string HtmlEscape(
    this string input,
    bool leaveSingleQuotesAlone = false,
    bool leaveDoubleQuotesAlone = false
)

Summary

Escapes all necessary characters in the specified string so as to make it usable safely in an HTML or XML context.

Parameters

this stringinput The string to apply HTML or XML escaping to.
boolleaveSingleQuotesAlone If true, does not escape single quotes (', U+0027).
boolleaveDoubleQuotesAlone If true, does not escape single quotes (", U+0022).

Returns

The specified string with the necessary HTML or XML escaping applied.