Class Extensions
Contains the LINQ to JSON extension methods.
Inheritance
Inherited Members
Namespace: Bayat.Json.Linq
Assembly: Bayat.Json.Runtime.dll
Syntax
public static class Extensions
Methods
| Improve this Doc View SourceAncestors<T>(IEnumerable<T>)
Returns a collection of tokens that contains the ancestors of every token in the source collection.
Declaration
public static IJEnumerable<JToken> Ancestors<T>(this IEnumerable<T> source)
where T : JToken
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<T> | source | An System.Collections.Generic.IEnumerable<T> of JToken that contains the source collection. |
Returns
Type | Description |
---|---|
IJEnumerable<JToken> | An System.Collections.Generic.IEnumerable<T> of JToken that contains the ancestors of every token in the source collection. |
Type Parameters
Name | Description |
---|---|
T | The type of the objects in source, constrained to JToken. |
AncestorsAndSelf<T>(IEnumerable<T>)
Returns a collection of tokens that contains every token in the source collection, and the ancestors of every token in the source collection.
Declaration
public static IJEnumerable<JToken> AncestorsAndSelf<T>(this IEnumerable<T> source)
where T : JToken
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<T> | source | An System.Collections.Generic.IEnumerable<T> of JToken that contains the source collection. |
Returns
Type | Description |
---|---|
IJEnumerable<JToken> | An System.Collections.Generic.IEnumerable<T> of JToken that contains every token in the source collection, the ancestors of every token in the source collection. |
Type Parameters
Name | Description |
---|---|
T | The type of the objects in source, constrained to JToken. |
AsJEnumerable(IEnumerable<JToken>)
Returns the input typed as IJEnumerable<T>.
Declaration
public static IJEnumerable<JToken> AsJEnumerable(this IEnumerable<JToken> source)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<JToken> | source | An System.Collections.Generic.IEnumerable<T> of JToken that contains the source collection. |
Returns
Type | Description |
---|---|
IJEnumerable<JToken> | The input typed as IJEnumerable<T>. |
AsJEnumerable<T>(IEnumerable<T>)
Returns the input typed as IJEnumerable<T>.
Declaration
public static IJEnumerable<T> AsJEnumerable<T>(this IEnumerable<T> source)
where T : JToken
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<T> | source | An System.Collections.Generic.IEnumerable<T> of JToken that contains the source collection. |
Returns
Type | Description |
---|---|
IJEnumerable<T> | The input typed as IJEnumerable<T>. |
Type Parameters
Name | Description |
---|---|
T | The source collection type. |
Children<T>(IEnumerable<T>)
Returns a collection of child tokens of every array in the source collection.
Declaration
public static IJEnumerable<JToken> Children<T>(this IEnumerable<T> source)
where T : JToken
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<T> | source | An System.Collections.Generic.IEnumerable<T> of JToken that contains the source collection. |
Returns
Type | Description |
---|---|
IJEnumerable<JToken> | An System.Collections.Generic.IEnumerable<T> of JToken that contains the values of every token in the source collection. |
Type Parameters
Name | Description |
---|---|
T | The source collection type. |
Children<T, U>(IEnumerable<T>)
Returns a collection of converted child tokens of every array in the source collection.
Declaration
public static IEnumerable<U> Children<T, U>(this IEnumerable<T> source)
where T : JToken
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<T> | source | An System.Collections.Generic.IEnumerable<T> of JToken that contains the source collection. |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<U> | An System.Collections.Generic.IEnumerable<T> that contains the converted values of every token in the source collection. |
Type Parameters
Name | Description |
---|---|
T | The source collection type. |
U | The type to convert the values to. |
Convert<T, U>(T)
Declaration
public static U Convert<T, U>(this T token)
where T : JToken
Parameters
Type | Name | Description |
---|---|---|
T | token |
Returns
Type | Description |
---|---|
U |
Type Parameters
Name | Description |
---|---|
T | |
U |
Convert<T, U>(IEnumerable<T>)
Declaration
public static IEnumerable<U> Convert<T, U>(this IEnumerable<T> source)
where T : JToken
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<T> | source |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<U> |
Type Parameters
Name | Description |
---|---|
T | |
U |
Descendants<T>(IEnumerable<T>)
Returns a collection of tokens that contains the descendants of every token in the source collection.
Declaration
public static IJEnumerable<JToken> Descendants<T>(this IEnumerable<T> source)
where T : JContainer
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<T> | source | An System.Collections.Generic.IEnumerable<T> of JToken that contains the source collection. |
Returns
Type | Description |
---|---|
IJEnumerable<JToken> | An System.Collections.Generic.IEnumerable<T> of JToken that contains the descendants of every token in the source collection. |
Type Parameters
Name | Description |
---|---|
T | The type of the objects in source, constrained to JContainer. |
DescendantsAndSelf<T>(IEnumerable<T>)
Returns a collection of tokens that contains every token in the source collection, and the descendants of every token in the source collection.
Declaration
public static IJEnumerable<JToken> DescendantsAndSelf<T>(this IEnumerable<T> source)
where T : JContainer
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<T> | source | An System.Collections.Generic.IEnumerable<T> of JToken that contains the source collection. |
Returns
Type | Description |
---|---|
IJEnumerable<JToken> | An System.Collections.Generic.IEnumerable<T> of JToken that contains every token in the source collection, and the descendants of every token in the source collection. |
Type Parameters
Name | Description |
---|---|
T | The type of the objects in source, constrained to JContainer. |
Properties(IEnumerable<JObject>)
Returns a collection of child properties of every object in the source collection.
Declaration
public static IJEnumerable<JProperty> Properties(this IEnumerable<JObject> source)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<JObject> | source | An System.Collections.Generic.IEnumerable<T> of JObject that contains the source collection. |
Returns
Type | Description |
---|---|
IJEnumerable<JProperty> | An System.Collections.Generic.IEnumerable<T> of JProperty that contains the properties of every object in the source collection. |
Value<U>(IEnumerable<JToken>)
Converts the value.
Declaration
public static U Value<U>(this IEnumerable<JToken> value)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<JToken> | value | A JToken cast as a System.Collections.Generic.IEnumerable<T> of JToken. |
Returns
Type | Description |
---|---|
U | A converted value. |
Type Parameters
Name | Description |
---|---|
U | The type to convert the value to. |
Value<T, U>(IEnumerable<T>)
Converts the value.
Declaration
public static U Value<T, U>(this IEnumerable<T> value)
where T : JToken
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<T> | value | A JToken cast as a System.Collections.Generic.IEnumerable<T> of JToken. |
Returns
Type | Description |
---|---|
U | A converted value. |
Type Parameters
Name | Description |
---|---|
T | The source collection type. |
U | The type to convert the value to. |
Values(IEnumerable<JToken>)
Returns a collection of child values of every object in the source collection.
Declaration
public static IJEnumerable<JToken> Values(this IEnumerable<JToken> source)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<JToken> | source | An System.Collections.Generic.IEnumerable<T> of JToken that contains the source collection. |
Returns
Type | Description |
---|---|
IJEnumerable<JToken> | An System.Collections.Generic.IEnumerable<T> of JToken that contains the values of every token in the source collection. |
Values(IEnumerable<JToken>, Object)
Returns a collection of child values of every object in the source collection with the given key.
Declaration
public static IJEnumerable<JToken> Values(this IEnumerable<JToken> source, object key)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<JToken> | source | An System.Collections.Generic.IEnumerable<T> of JToken that contains the source collection. |
System.Object | key | The token key. |
Returns
Type | Description |
---|---|
IJEnumerable<JToken> | An System.Collections.Generic.IEnumerable<T> of JToken that contains the values of every token in the source collection with the given key. |
Values<U>(IEnumerable<JToken>)
Returns a collection of converted child values of every object in the source collection.
Declaration
public static IEnumerable<U> Values<U>(this IEnumerable<JToken> source)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<JToken> | source | An System.Collections.Generic.IEnumerable<T> of JToken that contains the source collection. |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<U> | An System.Collections.Generic.IEnumerable<T> that contains the converted values of every token in the source collection. |
Type Parameters
Name | Description |
---|---|
U | The type to convert the values to. |
Values<U>(IEnumerable<JToken>, Object)
Returns a collection of converted child values of every object in the source collection with the given key.
Declaration
public static IEnumerable<U> Values<U>(this IEnumerable<JToken> source, object key)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<JToken> | source | An System.Collections.Generic.IEnumerable<T> of JToken that contains the source collection. |
System.Object | key | The token key. |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<U> | An System.Collections.Generic.IEnumerable<T> that contains the converted values of every token in the source collection with the given key. |
Type Parameters
Name | Description |
---|---|
U | The type to convert the values to. |
Values<T, U>(IEnumerable<T>, Object)
Declaration
public static IEnumerable<U> Values<T, U>(this IEnumerable<T> source, object key)
where T : JToken
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<T> | source | |
System.Object | key |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<U> |
Type Parameters
Name | Description |
---|---|
T | |
U |