Editar

Compartir a través de


JavaScriptConverter.SupportedTypes Property

Definition

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

public:
 abstract property System::Collections::Generic::IEnumerable<Type ^> ^ SupportedTypes { System::Collections::Generic::IEnumerable<Type ^> ^ get(); };
public abstract System.Collections.Generic.IEnumerable<Type> SupportedTypes { get; }
member this.SupportedTypes : seq<Type>
Public MustOverride ReadOnly Property SupportedTypes As IEnumerable(Of Type)

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) })); }
}
Public Overrides ReadOnly Property SupportedTypes() As _
    System.Collections.Generic.IEnumerable(Of System.Type)
    Get
        ' Define the ListItemCollection as a supported type.
        Return New ReadOnlyCollection(Of Type)(New List(Of Type) _
        (New Type() {GetType(ListItemCollection)}))
    End Get
End Property

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