Edit

Share via


JavaScriptConverter.SupportedTypes Property

Definition

When overridden in a derived class, gets a collection of the supported types.

public abstract System.Collections.Generic.IEnumerable<Type> SupportedTypes { get; }

Property Value

An object that implements IEnumerable<T> that represents the types supported by the converter.

Examples

The following example shows how to override the SupportedTypes property in a derived class. In this example, the converter supports only the ListItemCollection type. This code example is part of a larger example provided for the JavaScriptConverter class.

public override IEnumerable<Type> SupportedTypes
{
    //Define the ListItemCollection as a supported type.
    get { return new ReadOnlyCollection<Type>(new List<Type>(new Type[] { typeof(ListItemCollection) })); }
}

Remarks

The SupportedTypes property lists the types that are supported by the converter. At run time, a JavaScriptSerializer instance uses this property to determine the mapping of managed types to their corresponding custom converters.

Notes to Implementers

SupportedTypes must always return a collection, and the collection must contain at least one entry.

Applies to

Product Versions
.NET Framework 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1