Abstract base class for formatters. Handles read-only state, cloning and formatting of invalid values.

2.0

Hierarchy (view full)

Implements

Methods

  • Casts this object to the specified type. Throws error on failure.

    Type Parameters

    • T1

      The target type of the cast.

    • T2

      The type of the object to cast.

    Parameters

    Returns T1

  • Determines whether the specified object is equal to the current object.

    Parameters

    • obj: any

      The object to compare with the current object.

    Returns boolean

    true if the specified object is equal to the current object; otherwise, false.

  • Serves as the default hash function.

    Returns number

    A hash code for the current object.

  • Returns a string that represents the current object.

    Returns string

    A string that represents the current object.

  • Casts this object to the specified type. Returns null on failure.

    Type Parameters

    • T1

      The target type of the cast.

    • T2

      The type of the object to cast.

    Parameters

    Returns null | T1

  • Determines whether the specified object instances are considered equal.

    Parameters

    • objA: any

      The first object to compare.

    • objB: any

      The second object to compare.

    Returns boolean

    true if the objects are considered equal; otherwise, false. If both objA and objB are null, the method returns true.

Default capability

  • get CultureName(): string
  • Gets or sets the name of the culture that defines the default formatting.

    Returns string

    2.0

  • set CultureName(value): void
  • Parameters

    • value: string

    Returns void

  • get EmptyString(): string
  • Gets or sets the string used to indicate empty values. (FormatInvalid(error)).

    Returns string

    2.0

  • set EmptyString(value): void
  • Parameters

    • value: string

    Returns void

  • get ExactParse(): boolean
  • Gets or sets a value indicating whether the format of the string representation must match the specified format exactly or not. Default is false.

    Returns boolean

    2.0

  • set ExactParse(value): void
  • Parameters

    • value: boolean

    Returns void

  • get IsLocalized(): boolean
  • Gets a value indicating whether this formatter is localized and always uses CultureInfo derived from the current running thread or not.

    Returns boolean

    2.0

  • get IsReadOnly(): boolean
  • Gets a value indicating whether the formatter is read-only or not.

    Returns boolean

    2.0

  • Returns a writable copy of this formatter.

    Returns unknown

    A new formatter copied from the original formatter

    2.0

  • Override this method to convert an object to a string value.

    Parameters

    • obj: any

      An object to convert.

    Returns string

    A string value

    2.0

  • Override this method to convert a string value to an object.

    Parameters

    • str: string | String

      A string value to convert.

    Returns unknown

    An object.

    2.0

  • Converts a string representation to an object. A return value indicates whether the conversion succeeded or failed.

    Parameters

    Returns boolean

    true if str was converted successfully; otherwise, false.

    2.0