継承するクラスを作成し、ベースプロパティアイテムをシャドウBindingList(of T)
するプロパティを次のように追加しました
Item(indx as Integer)
<System.Reflection.DefaultMember("Item")> _
Public Class Unity(Of T As {New, Entity})
Inherits BindingList(Of T)
Implements IUnity
Public Property Item(ByVal indx As Integer) As T
Get
If indx >= Me.Count Then
Throw New ArgumentOutOfRangeException("index")
End If
If Not MyBase.Item(indx)._IsLoaded Then InitDataOfItemsInPage(indx)
Return MyBase.Item(indx)
End Get
Set(ByVal value As T)
MyBase.Item(indx) = value
End Set
End Property
......
End Class
今、私がアイテムにアクセスしようとすると、myUnity.Item(1)
すべてを書くことはうまくいきます。コードはプロパティItemに移動し、実行する必要があることを実行してmyEntityを返します。しかし、私が書くmyUnity(1)
と、プロパティアイテムを通過せずにmyEntityを取得します。理由を知っている人はいますか?