Class LinqExtensions
These extension methods cover LINQ compatibility.
Inheritance
Inherited Members
Namespace: Manatee.Json
Assembly: Manatee.Json.dll
Syntax
public static class LinqExtensions
Methods
| Improve this Doc View SourceFromJson<T>(IEnumerable<JsonValue>, JsonSerializer)
Deserializes a collection of JsonValues to an System.Collections.Generic.IEnumerable<T> of the objects.
Declaration
public static IEnumerable<T> FromJson<T>(this IEnumerable<JsonValue> json, JsonSerializer serializer)
where T : IJsonSerializable, new()
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<JsonValue> | json | The collection of JsonValues |
JsonSerializer | serializer | The JsonSerializer instance to use for additional serialization of values. |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<T> | A collection of the deserialized objects |
Type Parameters
Name | Description |
---|---|
T | The type of object contained in the collection |
FromJson<T>(Nullable<JsonObject>, JsonSerializer)
Deserializes a JsonValue to its equivalent object.
Declaration
public static T FromJson<T>(this JsonObject? json, JsonSerializer serializer)
where T : IJsonSerializable, new()
Parameters
Type | Name | Description |
---|---|---|
System.Nullable<JsonObject> | json | The JsonValue to deserialize |
JsonSerializer | serializer | The JsonSerializer instance to use for additional serialization of values. |
Returns
Type | Description |
---|---|
T | A collection of the deserialized objects |
Type Parameters
Name | Description |
---|---|
T | The type of object |
ToJson(IDictionary<String, Nullable<JsonValue>>)
Converts an System.Collections.Generic.IDictionary<TKey, TValue> into a JsonObject.
Declaration
public static JsonObject ToJson(this IDictionary<string, JsonValue? > results)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IDictionary<System.String, System.Nullable<JsonValue>> | results | An System.Collections.Generic.IDictionary<TKey, TValue> |
Returns
Type | Description |
---|---|
JsonObject | An equivalent JsonObject |
ToJson(IEnumerable<JsonValue>)
Converts an System.Collections.Generic.IEnumerable<T> returned from a LINQ query back into a JsonArray.
Declaration
public static JsonArray ToJson(this IEnumerable<JsonValue> results)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<JsonValue> | results | An System.Collections.Generic.IEnumerable<T> |
Returns
Type | Description |
---|---|
JsonArray | An equivalent JsonArray |
ToJson(IEnumerable<KeyValuePair<String, Nullable<JsonValue>>>)
Converts an System.Collections.Generic.IEnumerable<T> of System.Collections.Generic.KeyValuePair`2 returned from a LINQ query back into a JsonObject.
Declaration
public static JsonObject ToJson(this IEnumerable<KeyValuePair<string, JsonValue? >> results)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<System.String, System.Nullable<JsonValue>>> | results | An System.Collections.Generic.IEnumerable<T> of System.Collections.Generic.KeyValuePair`2 |
Returns
Type | Description |
---|---|
JsonObject | An equivalent JsonObject |
ToJson(Nullable<IEnumerable<JsonArray>>)
Declaration
public static JsonValue ToJson(this IEnumerable<JsonArray>? list)
Parameters
Type | Name | Description |
---|---|---|
System.Nullable<System.Collections.Generic.IEnumerable<JsonArray>> | list | A collection of JsonArrays |
Returns
Type | Description |
---|---|
JsonValue |
ToJson(Nullable<IEnumerable<JsonObject>>)
Converts a collection of JsonObjects to a JsonArray.
Declaration
public static JsonValue ToJson(this IEnumerable<JsonObject>? list)
Parameters
Type | Name | Description |
---|---|---|
System.Nullable<System.Collections.Generic.IEnumerable<JsonObject>> | list | A collection of JsonObjects |
Returns
Type | Description |
---|---|
JsonValue | A JsonArray containing the JsonObjects |
ToJson(Nullable<IEnumerable<Boolean>>)
Converts a collection of bools to a JsonArray.
Declaration
public static JsonValue ToJson(this IEnumerable<bool>? list)
Parameters
Type | Name | Description |
---|---|---|
System.Nullable<System.Collections.Generic.IEnumerable<System.Boolean>> | list | A collection of booleans |
Returns
Type | Description |
---|---|
JsonValue | A JsonArray containing the booleans |
ToJson(Nullable<IEnumerable<Double>>)
Converts a collection of doubles to a JsonArray.
Declaration
public static JsonValue ToJson(this IEnumerable<double>? list)
Parameters
Type | Name | Description |
---|---|---|
System.Nullable<System.Collections.Generic.IEnumerable<System.Double>> | list | A collection of doubles |
Returns
Type | Description |
---|---|
JsonValue | A JsonArray containing the doubles |
ToJson(Nullable<IEnumerable<Int32>>)
Converts a collection of doubles to a JsonArray.
Declaration
public static JsonValue ToJson(this IEnumerable<int>? list)
Parameters
Type | Name | Description |
---|---|---|
System.Nullable<System.Collections.Generic.IEnumerable<System.Int32>> | list | A collection of doubles |
Returns
Type | Description |
---|---|
JsonValue | A JsonArray containing the doubles |
ToJson(Nullable<IEnumerable<Nullable<Boolean>>>)
Converts a collection of System.Nullable<T> to a JsonArray.
Declaration
public static JsonValue ToJson(this IEnumerable<bool? >? list)
Parameters
Type | Name | Description |
---|---|---|
System.Nullable<System.Collections.Generic.IEnumerable<System.Nullable<System.Boolean>>> | list | A collection of System.Nullable<T> |
Returns
Type | Description |
---|---|
JsonValue | A JsonArray containing the System.Nullable<T> |
ToJson(Nullable<IEnumerable<Nullable<Double>>>)
Converts a collection of doubles to a JsonArray.
Declaration
public static JsonValue ToJson(this IEnumerable<double? >? list)
Parameters
Type | Name | Description |
---|---|---|
System.Nullable<System.Collections.Generic.IEnumerable<System.Nullable<System.Double>>> | list | A collection of doubles |
Returns
Type | Description |
---|---|
JsonValue | A JsonArray containing the doubles |
ToJson(Nullable<IEnumerable<Nullable<Int32>>>)
Converts a collection of doubles to a JsonArray.
Declaration
public static JsonValue ToJson(this IEnumerable<int? >? list)
Parameters
Type | Name | Description |
---|---|---|
System.Nullable<System.Collections.Generic.IEnumerable<System.Nullable<System.Int32>>> | list | A collection of doubles |
Returns
Type | Description |
---|---|
JsonValue | A JsonArray containing the doubles |
ToJson(Nullable<IEnumerable<Nullable<String>>>)
Converts a collection of strings to a JsonArray.
Declaration
public static JsonValue ToJson(this IEnumerable<string? >? list)
Parameters
Type | Name | Description |
---|---|---|
System.Nullable<System.Collections.Generic.IEnumerable<System.Nullable<System.String>>> | list | A collection of strings |
Returns
Type | Description |
---|---|
JsonValue | A JsonArray containing the strings |
ToJson<T>(IEnumerable<T>, JsonSerializer)
Serializes a collection of objects which implement IJsonSerializable to a JsonArray of equivalent JsonValues.
Declaration
public static JsonValue ToJson<T>(this IEnumerable<T> list, JsonSerializer serializer)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<T> | list | A collection of equivalent JsonValues |
JsonSerializer | serializer | The JsonSerializer instance to use for additional serialization of values. |
Returns
Type | Description |
---|---|
JsonValue | A JsonArray containing the equivalent JsonValues |
Type Parameters
Name | Description |
---|---|
T |
ToJson<T>(IEnumerable<KeyValuePair<String, T>>, JsonSerializer)
Converts an System.Collections.Generic.IEnumerable<T> of System.Collections.Generic.KeyValuePair`2 returned from a LINQ query back into a JsonObject.
Declaration
public static JsonObject ToJson<T>(this IEnumerable<KeyValuePair<string, T>> results, JsonSerializer serializer)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<System.String, T>> | results | An System.Collections.Generic.IEnumerable<T> of System.Collections.Generic.KeyValuePair`2 |
JsonSerializer | serializer | The JsonSerializer instance to use for additional serialization of values. |
Returns
Type | Description |
---|---|
JsonObject | An equivalent JsonObject |
Type Parameters
Name | Description |
---|---|
T |