RCI*_*CIX 1 methods syntax f# definition
我有一个方法(在这种情况下是静态的),我无法弄清楚定义它的确切语法.
static member FindPath : Queue<Node> startNode : Node endNode : Node nodes : List<Node> =
//this method will call two other to be constructed methods and return a
//queue that is the return value of one of them
return new Queue<Node>()
Run Code Online (Sandbox Code Playgroud)
它startNode与第一个节点之间的冒号失败:
"标记类型中的语法错误"
制作这样的方法的最佳方法是什么?
要使其成为多行,您可以在单独的行上进行调用
static member FindPath (startNode : Node) (endNode : Node) (nodes : List<Node>) =
let resultOfMethod1 = CallMethod1()
CallMethod2()
new Queue<Node>()
Run Code Online (Sandbox Code Playgroud)
我也删除了返回类型,因为如果你返回这样的队列你就不需要它