0
任何人都看到過嗎?ByRef參數不能按預期方式工作
Public Shared Function IsAvailableByCampaignId(ByVal cn As SqlConnection, ByVal tr As SqlTransaction, ByVal campaignId As Integer, ByRef dest As PricingThresholds) As Boolean
Dim retObj = ItemTypes.PricingThresholds.GetThresholds(cn, tr, campaignId)
If retObj IsNot Nothing Then
dest = New PricingThresholds(retObj)
End If
Dim retVal As Boolean = retObj IsNot Nothing
Return retVal
End Function
當我撥打電話到內
Dim retObj = ItemTypes.PricingThresholds.GetThresholds(cn, tr, campaignId)
我得到一個非空或沒有retObj,後來我用它來建立一個新的PricingThresholds它是正確的類型,我需要返回,併成功創建一個有效的返回類型的對象,但我從外部調用返回parm dest通過ByRef
沒有價值,是什麼也沒有或null。
這就像VB不工作。
我想我可以用不同的方式返回它。
VB.NET正在工作,你的代碼沒有做正確的事情。你能否告訴我們你在哪裏以及如何調用這個功能?問題可能在那裏。 – Styxxy