[英]use c# library in f#
我正在嘗試通過其C#API連接到盈透證券。 作為練習,我正在嘗試使用F#開發客戶。
這是我所做的:
我在.fs文件中創建了一個新模塊,如下所示:
open IBApi module ibConnectivity = type IBclient = interface EWrapper with member this.connectionClosed() = printfn "connection has been closed" member this.currentTime time = printfn "server time: %i" time ....
我收到以下錯誤消息:
錯誤1庫或多文件應用程序中的文件必須以名稱空間或模塊聲明開頭,例如'namespace SomeNamespace.SubNamespace'或'module SomeNamespace.SomeModule'
我已經到處搜尋解決方案。 我是一個完整的菜鳥。 一些帖子引用了F#文件的順序,但是在這種情況下,我正在使用C#庫。
這意味着您的文件必須以namespace
或module
聲明開頭。 像這樣:
module ibConnectivity
open IBApi
type IBclient =
interface EWrapper with
member this.connectionClosed() = printfn "connection has been closed"
member this.currentTime time = printfn "server time: %i" time
語法module Name = <indented declarations>
用於聲明在文件頂部聲明的模塊或名稱空間中的子模塊。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.