json class : IsDefined(string) method
Description
Gets a value indicating whether a member corresponding to the member name exists.
Syntax
jsonInstance.IsDefined(string memberName)
Arguments
Class | Name | Description |
string | memberName | A member name. |
Return value
Class | Description |
bool | A value indicating whether a member exists. |
Sample code
1: | json jsonIns = new json("{@name@:@suzuki@,@age@:1}".Replace("@","".DQ)); |
2: | bool exists = jsonIns.IsDefined("name"); // true |
3: | exists = jsonIns.IsDefined("age"); // true |
4: | exists = jsonIns.IsDefined("address"); // false |
Notes
If the instance is an JSON array, an exception is raised.
Only members that are direct children are searched.
Returns true if a member corresponding to the member name exists. Otherwise it returns false.
Links for reference
None