Click or drag to resize

HtmlBuilder Class

Represents a mutable Html string. This class leverages C#6 string interpolation feature to conveniently build XSS-safe (HTML) strings.
Inheritance Hierarchy
SystemObject
  MicaSystems.UtilsHtmlBuilder

Namespace:  MicaSystems.Utils
Assembly:  MicaSystems.Utils (in MicaSystems.Utils.dll) Version: 1.0.0.0 (1.1.0.123)
Syntax
C#
public class HtmlBuilder : IHtmlString

The HtmlBuilder type exposes the following members.

Constructors
  NameDescription
Public methodHtmlBuilder
Initializes a new instance of the HtmlBuilder class. This constructor will use the current culture for formatting.
Public methodHtmlBuilder(FormattableString)
Initializes a new instance of the HtmlBuilder class with the specified FormattableString. This constructor will use the current culture for formatting.
Public methodHtmlBuilder(IHtmlString)
Initializes a new instance of the HtmlBuilder class with the specified IHtmlString. This constructor will use the current culture for formatting.
Public methodHtmlBuilder(IHtmlString)
Initializes a new instance of the HtmlBuilder class with the specified IHtmlString and IFormatProvider. This constructor will use the current culture for formatting.
Public methodHtmlBuilder(IFormatProvider, FormattableString)
Initializes a new instance of the HtmlBuilder class with the specified FormattableString and IFormatProvider
Public methodHtmlBuilder(IFormatProvider, IHtmlString)
Initializes a new instance of the HtmlBuilder class with the specified IHtmlString and IFormatProvider
Public methodHtmlBuilder(IFormatProvider, IHtmlString)
Initializes a new instance of the HtmlBuilder class with the specified IHtmlString and IFormatProvider
Top
Properties
  NameDescription
Public propertyIsEmpty
Returns true if this html string contains no character.
Public propertyLength
Gets the length (after encoding) of the current html string
Top
Methods
  NameDescription
Public methodAppend(IEnumerableIHtmlString)
Appends multiple IHtmlString instances to this HtmlBuilder instance.
Public methodAppend(FormattableString)
Appends a FormattableString to this HtmlBuilder instance. Static parts of the template will be considered safe and won't be encoded while variable parts (between '{' and '}') will be html encoded.
Public methodAppend(FormattableString)
Appends a FormattableString to this HtmlBuilder instance. Static parts of the template will be considered safe and won't be encoded while variable parts (between '{' and '}') will be html encoded.
Public methodAppend(IHtmlString)
Appends a IHtmlString to this HtmlBuilder instance.
Public methodAppend(IHtmlString)
Appends multiple IHtmlString instances to this HtmlBuilder instance.
Public methodAppend(IEnumerableHtml)
Appends multiple Html instances to this HtmlBuilder instance.
Public methodAppendText
Appends (and encodes) a string to this HtmlBuilder instance.
Public methodClear
Removes all characters from this HtmlBuilder
Public methodStatic memberCreate
Initializes a new instance of the HtmlBuilder class. This will use the current culture for formatting.
Public methodToHtmlString
Returns an HTML-encoded string.
Public methodToString (Overrides ObjectToString.)
Top
Extension Methods
  NameDescription
Public Extension MethodAsT
Casts an object to another type. Returns default(T) if the object is null.
(Defined by Utils_Other.)
Public Extension MethodEqualsAll
Checks that this object is equal to every object in parameters.
(Defined by Utils_Other.)
Public Extension MethodEqualsAny
Checks that this object is equal to at least one of the parameters.
(Defined by Utils_Other.)
Public Extension MethodGetString
Converts an object to String using ToString() method, else returns String.Empty.
(Defined by Utils_Other.)
Public Extension MethodIsGenericListOverloaded.
Checks if this object is a System.Collections.Generic.List.
(Defined by Utils_Linq.)
Public Extension MethodIsGenericList(Type)Overloaded.
Checks if this object is a System.Collections.Generic.List using type as T.
(Defined by Utils_Linq.)
Public Extension MethodSerializeOverloaded.
Serializes an object into an XML document.
(Defined by Utils_Xml.)
Public Extension MethodSerialize(String)Overloaded.
Serializes an object into an XML document.
(Defined by Utils_Xml.)
Public Extension MethodSerializeJsonOverloaded.
Serializes an object using a DataContractJsonSerializer.
(Defined by Utils_String.)
Public Extension MethodSerializeJson(ListType)Overloaded.
Serializes an object using a DataContractJsonSerializer.
(Defined by Utils_String.)
Public Extension MethodSerializeJson(DataContractJsonSerializerSettings)Overloaded.
Serializes an object using a DataContractJsonSerializer.
(Defined by Utils_String.)
Top
See Also