ScriptObject.SetProperty Method (String, Object) (System.Windows.Browser)

Switch View :
ScriptFree
.NET Framework Class Library for Silverlight
ScriptObject.SetProperty Method (String, Object)

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)
Syntax

Visual Basic (Declaration)
Public Overridable Sub SetProperty ( _
	name As String, _
	value As Object _
)
C#
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.
Exceptions

Exception Condition
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.

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.

See Also

Reference