B
Bill Ray
I have the following function in my WidgetCollection class.
What is a more efficient way of doing this?
I tried the commented code below, but I couldn't get it to work.
Public Overloads ReadOnly Property Item(ByVal index As String) As
Widget
Get
Dim CurrentSetting, ReturnBO As Widget
For Each CurrentSetting In Me.InnerList
If CurrentSetting.DisplayID = index Then
ReturnBO = CurrentSetting
End If
Next
Return ReturnBO
End Get
End Property
I know this is a dumb question, but does all this go in the class,
collection class or factory?
'Private Shared mProperties As
System.ComponentModel.PropertyDescriptorCollection
'Protected Friend Sub New(ByVal creator As BizObjectFactory)
' MyBase.New(creator)
' mProperties = System.ComponentModel.TypeDescriptor.GetProperties(GetType(Widget))
'End Sub
'Default Public Overloads Property Item(ByVal name As String) As
Widget
' Get
' Return mProperties(name).GetValue(Me)
' End Get
' Set(ByVal value As Widget)
' mProperties(name).SetValue(Me, value)
' End Set
'End Property
What is a more efficient way of doing this?
I tried the commented code below, but I couldn't get it to work.
Public Overloads ReadOnly Property Item(ByVal index As String) As
Widget
Get
Dim CurrentSetting, ReturnBO As Widget
For Each CurrentSetting In Me.InnerList
If CurrentSetting.DisplayID = index Then
ReturnBO = CurrentSetting
End If
Next
Return ReturnBO
End Get
End Property
I know this is a dumb question, but does all this go in the class,
collection class or factory?
'Private Shared mProperties As
System.ComponentModel.PropertyDescriptorCollection
'Protected Friend Sub New(ByVal creator As BizObjectFactory)
' MyBase.New(creator)
' mProperties = System.ComponentModel.TypeDescriptor.GetProperties(GetType(Widget))
'End Sub
'Default Public Overloads Property Item(ByVal name As String) As
Widget
' Get
' Return mProperties(name).GetValue(Me)
' End Get
' Set(ByVal value As Widget)
' mProperties(name).SetValue(Me, value)
' End Set
'End Property