Skip to content

TypeExporter.ExportType method

Exports a specific .NET type to JS.

C#
public JSReference ExportType(Type type, bool? deferMembers = null)
parameterdescription
typeThe .NET type to export.
deferMembersTrue to delay exporting of all type members until each one is accessed. If false, all type members are immediately exported, which may cascade to exporting many additional types referenced by the members, including members that are never actually used. The default is from IsDelayLoadEnabled.

Return Value

A strong reference to a JS object that represents the exported type.

Exceptions

exceptioncondition
NotSupportedExceptionThe .NET type cannot be exported.

Remarks

This method does NOT register namespaces for the exported type on the JS "namespaces" object (if one was passed to the TypeExporter constructor). It is sufficient for explicit marshalling of the exported type using .NET code, but not for dynamic access of the .NET type from JS code. Use !:ExportAssemblyTypes() instead for full namespace export.

See Also

Released under the MIT license