ScriptObject.GetProperty Method (Int32)

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

Gets the value of a property that is identified by ordinal number on the current scriptable object.

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

Syntax

'Declaration
Public Function GetProperty ( _
    index As Integer _
) As Object
public Object GetProperty(
    int index
)

Parameters

  • index
    Type: System.Int32
    The ordinal number of the property.

Return Value

Type: System.Object
A null reference (Nothing in Visual Basic) if the property does not exist or if the underlying ScriptObject is a managed type.

Remarks

Return values follow the rules for returning types from JavaScript to managed code by using by-reference marshaling rules. For more information, see Returning or Passing Managed Types to JavaScript.

The actual type of the return value is always a string, a primitive type, or a ScriptObject reference. If the underlying value of the requested property is a managed type (other than a derivation of ScriptObject), you can use the ManagedObject property to get the underlying managed type reference.

If the underlying ScriptObject is a managed type, it is not possible to get either scriptable managed methods or scriptable event properties (that is, properties with the event keyword). In both cases, this method returns nulla null reference (Nothing in Visual Basic).

Examples

The following example shows how you can access individual items in a ScriptObject that contains a JavaScript array.

// Gets the sixth item in a simple JavaScript array.
GetProperty(5);

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.