Github user jorgebay commented on a diff in the pull request: https://github.com/apache/tinkerpop/pull/817#discussion_r175035051 --- Diff: gremlin-dotnet/src/Gremlin.Net/Process/Traversal/P.cs --- @@ -148,12 +154,29 @@ public static P Test(params object[] args) public static P Within(params object[] args) { - return new P("within", args); + if (args.Length == 1 && args[0].GetType().GetInterfaces().Contains(typeof(ICollection))) + return new P("within", ToGenericArray((ICollection<object>) args[0])); + else + return new P("within", args); } public static P Without(params object[] args) { - return new P("without", args); + if (args.Length == 1 && args[0].GetType().GetInterfaces().Contains(typeof(ICollection))) + return new P("without", ToGenericArray((ICollection<object>) args[0])); + else + return new P("without", args); + } + + + private static T[] ToGenericArray<T>(ICollection<T> collection) + { + if (collection == null) --- End diff -- We can express the logic in this method using null-conditional and null-coalescing operators: ```csharp private static T[] ToGenericArray<T>(ICollection<T> collection) { return collection?.ToArray() ?? new T[0]; } ```
---