encoder class : HtmlEncode(string) method

Description

Encodes a string using HTML encoding.

Syntax

encoderInstance.HtmlEncode(string anyString)

Arguments

ClassNameDescription
stringanyStringA string.

Return value

ClassDescription
stringA string encoded by HTML encoding.

Sample code

1:

encoder e = new encoder();

2:

string any = "<>";

3:

string encoded = e.HtmlEncode(any); // The result is "&lt;&gt;".

Notes

It's a wrapper of the System.Web.HttpUtility.HtmlEncode(String) method.

Links for reference

Copyright © Cooker All rights reserved.