F# 方法定义语法
我有一个方法(在本例中是静态的),但我不太清楚定义它的确切语法。
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
和第一个节点之间的冒号上失败:
“标记类型中的语法错误”
制作这样的方法的最佳方法是什么?
I have a method (static in this case) and I can't quite figure out the exact syntax for defining it.
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>()
It fails on the colon between startNode
and the first Node with:
"Syntax error in labelled type"
What would be the best way to make a method like this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
要使其成为多行,您只需在单独的行上进行调用
我还删除了返回类型,因为如果您返回这样的队列,则不需要它
To make it multiline you can just make the calls on separate lines
Also i removed the return type because you shouldn't need it if you return a queue like that