Class JsonArray
This class represents JArray in JSON standards.
Assembly: Alachisoft.NCache.Runtime.dll
Syntax
[Serializable]
public sealed class JsonArray : JsonValueBase, IJsonArray, ICollection<JsonValueBase>, IEnumerable<JsonValueBase>, IEnumerable
Constructors
JsonArray()
The default constructor of class JsonArray.
Declaration
public JsonArray()
JsonArray(String)
An overloaded constructor that takes JsonArray object in string format.
Declaration
public JsonArray(string json)
Parameters
Type | Name | Description |
---|---|---|
System.String | json | JSONArray object in string format. |
Properties
Count
This property gets total items in array.
Declaration
public int Count { get; }
Property Value
Type | Description |
---|---|
System.Int32 | Number of items in array. |
InMemorySize
This property gets memory size of the JSONArray.
Declaration
protected override int InMemorySize { get; }
Property Value
Type | Description |
---|---|
System.Int32 | Size of the memory. |
Overrides
Item[Int32]
Indexer for the JSON Arary.
Declaration
public JsonValueBase this[int index] { get; set; }
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index | Index of the item. |
Property Value
Type | Description |
---|---|
JsonValueBase | JSON value on that index. |
Implements
Size
This property gets the size of the JSONArray.
Declaration
protected override int Size { get; }
Property Value
Type | Description |
---|---|
System.Int32 | Size of the JSONArray. |
Overrides
Value
This property initializes JSONArray instance.
Declaration
public override object Value { get; }
Property Value
Type | Description |
---|---|
System.Object | Value of JSONArray instance. |
Overrides
Methods
Add(JsonValue)
Adds JSONValue item to array.
Declaration
public void Add(JsonValue item)
Parameters
Type | Name | Description |
---|---|---|
JsonValue | item | JSONValue to be added. |
Implements
Add(JsonValueBase)
Adds JSONValueBase item to array.
Declaration
public void Add(JsonValueBase item)
Parameters
Type | Name | Description |
---|---|---|
JsonValueBase | item | JSONValueBase to be added. |
Clear()
Clears all array items and brings count to 0.
Declaration
public void Clear()
Contains(JsonValue)
Checks if a JSONValue item exits in array.
Declaration
public bool Contains(JsonValue item)
Parameters
Type | Name | Description |
---|---|---|
JsonValue | item | Item to be found. |
Returns
Type | Description |
---|---|
System.Boolean | True, if exits. |
Implements
Contains(JsonValueBase)
Checks if a JsonValueBase item exits in array.
Declaration
public bool Contains(JsonValueBase item)
Parameters
Type | Name | Description |
---|---|---|
JsonValueBase | item | Item to be found. |
Returns
Type | Description |
---|---|
System.Boolean | True, if exits. |
CopyTo(JsonValueBase[], Int32)
Copies items from provided array starting from a particular array index.
Declaration
public void CopyTo(JsonValueBase[] array, int arrayIndex)
Parameters
Type | Name | Description |
---|---|---|
JsonValueBase[] | array | Array from which the items have to be copied. |
System.Int32 | arrayIndex | Starting index of the array from which to start copying. |
Equals(Object)
Checks if an object is equal to this instance of JSONArray.
Declaration
public override bool Equals(object obj)
Parameters
Type | Name | Description |
---|---|---|
System.Object | obj | An object of the ultimate base class of all classes in the .NET Framework; it is the root of the type hierarchy. |
Returns
Type | Description |
---|---|
System.Boolean | An object of the ultimate base class of all classes in the .NET Framework. |
Overrides
GetEnumerator()
Returns an enumerator that iterates through JSONArray items.
Declaration
public IEnumerator<JsonValueBase> GetEnumerator()
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerator<JsonValueBase> | Enumerator that iterates through JSONArray items. |
Remove(JsonValue)
Removes JSONValue item from array.
Declaration
public bool Remove(JsonValue item)
Parameters
Type | Name | Description |
---|---|---|
JsonValue | item | Item to be removed. |
Returns
Type | Description |
---|---|
System.Boolean | True, if item exists and is removed successfully. |
Implements
Remove(JsonValueBase)
Removes JsonValueBase item from array.
Declaration
public bool Remove(JsonValueBase item)
Parameters
Type | Name | Description |
---|---|---|
JsonValueBase | item | Item to be removed. |
Returns
Type | Description |
---|---|
System.Boolean | True, if item exists and is removed successfully. |
ToString()
Returns JSONArray in string representation.
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
System.String | JSONArray in string representation. |