using System.Collections; using System.Collections.Generic; using System.Linq; using Newtonsoft.Json.Linq; namespace RethinkDb.Driver.Ast { /// /// Extension helpers for working with the AST. /// public static class ExtensionHelper { internal static JObject ToJObject(this object anonType) { return anonType == null ? null : JObject.FromObject(anonType); } internal static IDictionary ToDict(this object anonType) { return anonType == null ? null : PropertyHelper.ObjectToDictionary(anonType); } /// /// Uses a collection as parameters for a method call. /// /// Same as calling params object[] overload. Instead of specifying each param, ICollection can be used for convenience. public static object[] AsParams(this ICollection args) { return args.OfType().ToArray(); } } }