Aetheria/Assets/Scripts/ServerShared/NIH/RethinkDb.Driver/Ast/ExtensionHelper.cs
hyperion51 e96146b7bb Out with MagicOnion, in with LiteNetLib
Removed MagicOnion
Added LiteNetLib
Created client and server abstractions
Fixed serialization bugs
2020-03-24 14:36:22 +00:00

31 lines
No EOL
1 KiB
C#

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