Documentation for: ASP.NET Ajax Version 1.0

This documentation is for a previous version. For the current released version, see the ASP.NET Ajax documentation on MSDN.

 

 

 

 

 

 

 

GenerateScriptTypeAttribute Constructor (type)

Initializes a new instance of the GenerateScriptTypeAttribute class for the specified type.

Syntax

CSharp

public GenerateScriptTypeAttribute (
	Type type
)

VisualBasic

Public Sub New ( _
	type As Type _
)

ManagedCPlusPlus

public:
GenerateScriptTypeAttribute (
	Type^ type
)

JSharp

public GenerateScriptTypeAttribute (
	Type type
)

Parameters

type (Type)

The Type to include in the proxy class.

Remarks

The ScriptTypeId property is an optional named parameter for this constructor.

Examples

The following example demonstrates how to use GenerateScriptTypeAttribute to generate a proxy object for the specified type that uses a specific type identifier for the metadata marker.

CS

[GenerateScriptType(typeof(ColorObject), 
    ScriptTypeId = "Color")]
[WebMethod]
public string[] GetDefaultColor()
{
    // Instantiate the default color object.
    ColorObject co = new ColorObject();

    return co.rgb;
}

VB

<GenerateScriptType(GetType(ColorObject), ScriptTypeId:="Color")> _
<WebMethodAttribute()> _
Public Function GetDefaultColor() As String()
    ' Instantiate the default color object.
    Dim co As New ColorObject()

    Return co.RGB

End Function

Permissions

  • AspNetHostingPermission

    for operating in a hosted environment. Demand value: LinkDemand. Associated enumeration: Minimal.

Exceptions

ExceptionCondition
ArgumentNullException

type is null.

Assembly: System.Web.Extensions (Module: System.Web.Extensions)