DynamicJsonObject.TrySetIndex Method
Sets the value of a DynamicJsonObject field using the specified index.
Namespace: System.Web.Helpers
Assembly: System.Web.Helpers (in System.Web.Helpers.dll)
Syntax
'Declaration
Public Overrides Function TrySetIndex ( _
binder As SetIndexBinder, _
indexes As Object(), _
value As Object _
) As Boolean
'Usage
Dim instance As DynamicJsonObject
Dim binder As SetIndexBinder
Dim indexes As Object()
Dim value As Object
Dim returnValue As Boolean
returnValue = instance.TrySetIndex(binder, _
indexes, value)
public override bool TrySetIndex(
SetIndexBinder binder,
Object[] indexes,
Object value
)
public:
virtual bool TrySetIndex(
SetIndexBinder^ binder,
array<Object^>^ indexes,
Object^ value
) override
abstract TrySetIndex :
binder:SetIndexBinder *
indexes:Object[] *
value:Object -> bool
override TrySetIndex :
binder:SetIndexBinder *
indexes:Object[] *
value:Object -> bool
public override function TrySetIndex(
binder : SetIndexBinder,
indexes : Object[],
value : Object
) : boolean
Parameters
- binder
Type: System.Dynamic.SetIndexBinder
Provides information about the indexed set operation.
- indexes
Type: System.Object[]
An array that contains a single object that indexes the field by name. The object must be convertible to a string that specifies the name of the JSON field to return. If multiple indexes are specified, no field is changed or added.
- value
Type: System.Object
The value to set the field to.
Return Value
Type: System.Boolean
true in all cases.
Remarks
Important
If multiple indexes are specified by the indexes parameter, no field is changed or added to the DynamicJsonObject instance, but the TrySetIndex method always returns true, which indicates success. This error is not reported to your code.
If no field is found that has a name that matches the name that was specified by the indexes parameter, a new field that has the specified name is created on the DynamicJsonObject instance and initialized to the specified value.