Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Gremlin.Net Casting from Enumerable.SelectIListIterator object to real type

I don't know if my question is about c# and casting or related to Gremlin.net Library return Types. I am using this query to get vertices with their db ids.

 g.V().As("vertex").ValueMap<IDictionary<string, object>>()
  .As("properties").Select<object>("vertex", "properties")
  .ToList()

properties is a list of attribute of the vertex. when I try to get the value of any property I found that its type is object with the below definition
property.Value = {System.Linq.Enumerable.SelectIListIterator< Newtonsoft.Json.Linq.JToken, object>}

I can't find a way to cast it to get the value. Thanks in advance.

like image 993
janus graph Avatar asked Jan 13 '18 22:01

janus graph


1 Answers

To get the value from {System.Linq.Enumerable.SelectIListIterator< Newtonsoft.Json.Linq.JToken, object>} object you can use:

(property.Value as IEnumerable<object>).Cast<object>().ToList() this will return List< object>

like image 98
janus graph Avatar answered Sep 28 '22 09:09

janus graph