【发布时间】:2012-07-20 06:47:54
【问题描述】:
我正在尝试使用http://msdn.microsoft.com/en-us/library/aa289500%28v=vs.71%29.aspx
它工作正常,但我经常在 VB 版本中看到 Item
但是,button.Item 在 C# 中不存在,但是当我打开一个新项目并在 VB.NET 中尝试时,我得到了Item。为什么会这样?如何在 C# 中使用 Item?
Visual Basic
Default Public ReadOnly Property Item(ByVal Index As Integer) As _
System.Windows.Forms.Button
Get
Return CType(Me.List.Item(Index), System.Windows.Forms.Button)
End Get
End Property
C#
public System.Windows.Forms.Button this [int Index]
{
get
{
return (System.Windows.Forms.Button) this.List[Index];
}
}
【问题讨论】:
标签: c# vb.net visual-studio-2012