Sdílet prostřednictvím


HtmlPage.RegisterCreateableType Method

Microsoft Silverlight will reach end of support after October 2021. Learn more.

Registers a managed type as available for creation from JavaScript code, through the Content.services.createObject and Content.services.createManagedObject helper methods.

Namespace:  System.Windows.Browser
Assembly:  System.Windows.Browser (in System.Windows.Browser.dll)

Syntax

'Declaration
Public Shared Sub RegisterCreateableType ( _
    scriptAlias As String, _
    type As Type _
)
public static void RegisterCreateableType(
    string scriptAlias,
    Type type
)

Parameters

  • scriptAlias
    Type: System.String
    The name used to register the managed type.

Exceptions

Exception Condition
ArgumentNullException

scriptAlias or type is nulla null reference (Nothing in Visual Basic).

ArgumentException

type is not public.

-or-

type does not have a public, parameterless constructor.

-or-

type is a string, primitive or value type, managed delegate, or empty string.

-or-

type contains an embedded null character (\0).

-or-

An attempt is made to reregister type.

Remarks

Use the scriptAlias parameter to indicate the managed type you want to create .

Version Information

Silverlight

Supported in: 5, 4, 3

Platforms

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.