0

if I review the overloads available for the Return method, which I can do like this:

[System.Reflection.Assembly]::LoadFrom("C:\...\Newtonsoft.Json.6.0.3\lib\net40\NewtonSoft.Json.dll")
[System.Reflection.Assembly]::LoadFrom("C:\...\Neo4jClient.1.0.0.662\lib\net40\Neo4jClient.dll")

$neo = new-object Neo4jClient.GraphClient(new-object Uri("http://localhost:7474/db/data"))
$q=$neo.Cypher.Match("n").Return({param($m) $m});
$neo.Cypher.Match("n").Return.OverloadDefinitions

I see something like this:

Neo4jClient.Cypher.ICypherFluentQuery[TResult] Return[TResult](string identity)

Neo4jClient.Cypher.ICypherFluentQuery[TResult] Return[TResult](System.Linq.Expressions.Expression[System.Func[TResult]] expression)

Neo4jClient.Cypher.ICypherFluentQuery[TResult] Return[TResult](System.Linq.Expressions.Expression[System.Func[Neo4jClient.Cypher.ICypherResultItem,TResult]] expression)

from which I read that the first overload takes a single string parameter, however, how do I read the second overload? it takes a linq expression, which [contains|accepts] a parameterless function that returns type TResult?

and what about the third, where the function takes 2 parameters? is it two parameters or one parameter and a return type?

how do I read this syntax?

Community
  • 1
  • 1
ekkis
  • 9,804
  • 13
  • 55
  • 105
  • The `OverloadDefinitions` are simply method signatures. Look up the documentation for the Neo4jClient assembly if you need further information – Mathias R. Jessen May 20 '15 at 16:13

2 Answers2

2

This source file should provide the signatures in a readable manner.

cybersam
  • 63,203
  • 6
  • 53
  • 76
  • ah... so the angle brackets of the normal notation get replaced with square brackets, to indicate generics... ok – ekkis May 20 '15 at 16:53
  • in fact, this question was prompted by another one: http://stackoverflow.com/questions/30314696/return-overload-fails that perhaps you could answer? – ekkis May 20 '15 at 16:54
1

so one part of the answer is that the output replaces the normal angle brackets with square brackets, so this:

Neo4jClient.Cypher.ICypherFluentQuery[TResult] Return[TResult](string identity)

should actually be this:

Neo4jClient.Cypher.ICypherFluentQuery<TResult> Return<TResult>(string identity)

so it's now clear that these are generics (see: https://msdn.microsoft.com/en-us/library/ms379564%28v=vs.80%29.aspx)

which means to say that:

System.Linq.Expressions.Expression<System.Func<TResult>>

means a linq expression typed as a function that returns TResult

ekkis
  • 9,804
  • 13
  • 55
  • 105