ScriptObject.SetProperty Method (String, Object)

Silverlight

Sets a property that is identified by name on the current scriptable object.

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

public virtual void SetProperty(
	string name,
	Object value
)

Parameters

name
Type: System.String
The name of the property.
value
Type: System.Object
The value to set the property to.

ExceptionCondition
ArgumentNullException

name is null.

ArgumentException

name is an empty string.

-or-

name contains an embedded null character (\0).

InvalidOperationException

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

-or-

The property is not settable.

-or-

All other failures.

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.

Silverlight

Supported in: 5, 4, 3

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

Community Additions

ADD
Show: