TypeExporter.ExportType method
Exports a specific .NET type to JS.
C#
public JSReference ExportType(Type type, bool? deferMembers = null)
parameter | description |
---|---|
type | The .NET type to export. |
deferMembers | True 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
exception | condition |
---|---|
NotSupportedException | The .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
- class JSReference
- class TypeExporter
- namespace Microsoft.JavaScript.NodeApi.DotNetHost