json class : IsDefined(int) method

Description

Gets a value indicating whether a value corresponding to the index exists.

Syntax

jsonInstance.IsDefined(int index)

Arguments

ClassNameDescription
intindexAn index.

Return value

ClassDescription
boolA value indicating whether a value exists.

Sample code

1:

jsonIns = new json("[@name@,true,1000,null]".Replace("@","".DQ)); // array

2:

bool exists = jsonIns.IsDefined(0); // true

3:

exists = jsonIns.IsDefined(1); // true

4:

exists = jsonIns.IsDefined(2); // true

5:

exists = jsonIns.IsDefined(3); // true

6:

exists = jsonIns.IsDefined(4); // false

Notes

If the instance is an JSON object, an exception is raised.

Only values that are direct children are searched.

Returns true if a value corresponding to the index exists. Otherwise it returns false.

Links for reference

None

Copyright © Cooker All rights reserved.