2011-09-19 163 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