2011-09-19 166 views
0

有人能告诉我什么是下面的代码提取VB.NET 2010相当于: “this”被转换为什么?我需要一些帮助。多谢你们。C#代码转换

public class CartItemList 
{ 
    public CartItem this[int index] 
    { 
    get{ return cartItems[index];} 
    set{ cartItems[index] = value;} 
    } 
} 

回答

5

这是VB中的default property,例如,

Default Public Property Item(ByVal id As String) As Cart 
    Get 
     Return id & Now().ToString 
    End Get 
End Property 

(目前尚不清楚该string如何意味着即使是在C#代码转换为Cart,你要知道...)

+0

对不起伙计。我的错。我很累,输入错了。但我想你的答案是正确的。非常感谢超级快速回答:) – user952982

0
Public Class CartItemList 
    Default Public ReadOnly Property Item(id As String) As Cart 
     Get 
      Return id + Now().ToString() 
     End Get 
    End Property 
End Class