1

我有一个方法(在这种情况下是静态的),我不太清楚定义它的确切语法。

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>()

startNode它在第一个节点和第一个节点之间的冒号上失败:

“标记类型中的语法错误”

制作这样的方法的最佳方法是什么?

4

2 回答 2

5

要使其成为多行,您只需在单独的行上进行调用

static member FindPath (startNode : Node) (endNode : Node) (nodes : List<Node>) = 
        let resultOfMethod1 = CallMethod1()
        CallMethod2()
        new Queue<Node>()

我还删除了返回类型,因为如果您返回这样的队列,则不需要它

于 2009-06-14T08:03:36.640 回答
3
static member FindPath (startNode : Node)
                       (endNode : Node)
                       (nodes : List<Node>)
                     : Queue<Node>
   = new Queue<Node>()
于 2009-06-14T06:53:53.203 回答