日期:2014-05-19  浏览次数:20400 次

请问一句c#代码的意思
我是一个vb程序员,对c#不懂。
今天看书上的一个例子,其中
public   class   TSqlDB
{
#region   公有属性
public   TSqlDBItem   this[string   index] //   缺省索引器

public   TSqlDBItem   this[string   index] 是什么意思,用vb该怎么写?

------解决方案--------------------
这应该是集合的索引器
MSDN上可以去看一看
------解决方案--------------------
这是索引器,可以这样用:
TSqlDB db = new TSqlDB();
TSqlDBItem a = db[ "aaa "]

VB里面没有,不过可以用属性实现
Public Property Item(index As Integer) As TSqlDBItem
Get
Return CType((List(index)), TSqlDBItem )
End Get
Set (ByVal Value As TSqlDBItem )
List(index) = value
End Set
End Property

------解决方案--------------------
索引器
可以用下标和KEY进行索引
------解决方案--------------------
索引器:
可以把對象當作樹組來使用!