CrystalJsonMarshall
Namespace: SnowBank.Data.Json · class
Advanced methods only intended to be used by generated code
Remarks
CAUTION: misuse of this type MAY cause runtime corruption!
Methods
CreateArrayFromValues
static JsonArray CreateArrayFromValues(JsonValue[] items, int size, bool readOnly)
Returns a JSON Array that wraps an existing array of values, without copying any content.
items— Buffer that contains a set of JSON values, which should be used by the new JSON Array.size— Number of items from the start ofitemsthat will make up the arrayreadOnly— Iftrue, mark the array as read-only, in which case all elements initemsMUST also be read-only!
Returns: JSON Array that reuse the existing buffer
This is only intended to be used when the caller is ABSOLUTELY SURE that no item in the buffer is null
If readOnly is true, but some items are mutable, this would violate the invariants of JsonArray and break your application!
CreateObjectFromDictionary
static JsonObject CreateObjectFromDictionary(Dictionary<string, JsonValue> items, bool readOnly)
Returns a JSON Object that wraps an existing dictionary of key/value pairs,
items— Dictionary that contains a set of key/value pairsreadOnly— Iftrue, mark the object as read-only, in which case all elements initemsMUST also be read-only!
Returns: JSON Array that reuse the existing buffer
This is only intended to be used when the caller is ABSOLUTELY SURE that NO item in the dictionary is null.
If readOnly is true, but some items are mutable, this would violate the invariants of JsonObject and break your application!
FreezeTopLevel
static JsonObject FreezeTopLevel(JsonObject obj)
Marks a JSON Object as read-only, without recursively freezing its children.
This is only intended to be used when the caller is ABSOLUTELY SURE that all the children in the object are already read-only.
If any children is still mutable, this will break the invariant contract of read-only objects.
static JsonArray FreezeTopLevel(JsonArray array)
Marks a JSON Array as read-only, without recursively freezing its items.
This is only intended to be used when the caller is ABSOLUTELY SURE that all the items in the array are already read-only.
If any item is still mutable, this will break the invariant contract of read-only objects.