ScriptObject.SetProperty Method (Int32, Object)

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

Sets 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 Sub SetProperty ( _
    index As Integer, _
    value As Object _
)
public void SetProperty(
    int index,
    Object value
)

Parameters

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

Exceptions

Exception Condition
ArgumentNullException

index is nulla null reference (Nothing in Visual Basic).

ArgumentException

index identifies an empty string.

InvalidOperationException

A type mismatch exists between the supplied type and the target property.

-or-

The property is not settable.

-or-

All other failures.

Remarks

The possible types for value follow the rules for passing managed types to JavaScript using by-reference marshaling rules. For more information, see Returning or Passing Managed Types to JavaScript.

It is possible to set a property value for a non-existing property. In this case, the browser adds the property as an expando on the object.

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.