我目前正在從VB項目轉換到C#。我在C#項目(添加Web引用)中引用的VB項目中有一個Web參考。 簽名是相同的。 VB代碼如下所示:VB到C#參數
If Not tws.StartSession(tsd) Then
Throw New systemMonitor.internalEx.securityEx("Failed to initiate a TROPOS session")
End If
我試圖隱蔽跨越就象這樣:
// Start our session
if (!this._service.StartSession(this._details))
throw new Exception("The TROPOS session failed to start.");
我的問題是,它不會編譯,並與錯誤出現:
argument 1 must be passed with the 'ref' keyword
所以我改成了這樣:
// Start our session
if (!this._service.StartSession(ref this._details))
throw new Exception("The TROPOS session failed to start.");
編譯並運行的
(雖然似乎沒有發生,但這是另一個問題)。 我的問題很簡單。 在VB中,你不必設置ByRef關鍵字?
請問這個http://stackoverflow.com/questions/9207620/why-is-it-not-necessary-to-indicate-byval-byref-anymore有什麼幫助嗎? – bi0phaz3
也顯示全班。對彼此而言。 vb和c# – Seabizkit
它解釋了這些差異,但並沒有說它是否需要在VB中呢? – r3plica