1 // Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.
3 using System.Collections.Generic;
4 using System.ComponentModel;
5 using System.Diagnostics.CodeAnalysis;
10 /// This class extends the funcionality of the <see cref="JsonValue"/> type for better Linq support .
12 [SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", Justification = "Linq is a technical name.")]
13 [EditorBrowsable(EditorBrowsableState.Never)]
14 public static class JsonValueLinqExtensions
17 /// Extension method for creating a <see cref="JsonValue"/> from an <see cref="IEnumerable{T}"/> collection of <see cref="JsonValue"/> types.
19 /// <param name="items">The enumerable instance.</param>
20 /// <returns>A <see cref="JsonArray"/> created from the specified items.</returns>
21 public static JsonArray ToJsonArray(this IEnumerable<JsonValue> items)
23 return new JsonArray(items);
27 /// Extension method for creating a <see cref="JsonValue"/> from an <see cref="IEnumerable{T}"/> collection of <see cref="KeyValuePair{K,V}"/> of <see cref="String"/> and <see cref="JsonValue"/> types.
29 /// <param name="items">The enumerable instance.</param>
30 /// <returns>A <see cref="JsonValue"/> created from the specified items.</returns>
31 [SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Justification = "JsonValue implements the nested type in param.")]
32 public static JsonObject ToJsonObject(this IEnumerable<KeyValuePair<string, JsonValue>> items)
34 return new JsonObject(items);