我在类中有一个函数,我想返回类本身但是"返回此"在VB中似乎无效.
我使用ASP.NET v1.1,如果这有所作为?
样本(极简化)代码如下:
Public Class Cart Private sItems As String Public Function addItem(ByVal itemName As String) As Cart sItems = sItems + "|" + itemName + "|" Return THIS End Function End Class
任何帮助将不胜感激.非常感谢.
在VB中,我是关键字,对于您所在的课程,请尝试
Public Class Cart Private sItems As String Public Function addItem(ByVal itemName As String) As Cart sItems = sItems + "|" + itemName + "|" Return Me End Function End Class