我在标有“<<<<”
的行上收到以下错误Method not found: 'Void System.Collections.Generic.Dictionary`2.System.Collections.Generic.ICollection<TKey>.Add(!0)'.
这是代码。
请注意,uiControl包含对UI控件的引用,而eventHandler并不是什么。
Public Function AddControlChangedEventHandler(ByVal uiControl As Control, _
ByVal eventName As String) As Boolean
'determine which value changed event handler this control accepts...
Dim eventHandler As EventInfo = GetControlValueChangedEventHandler(uiControl, eventName)
Dim eventSubscribed As Boolean = eventHandler IsNot Nothing
'if I found it
If eventSubscribed Then
Try
'...subscribe to it
SubscribeToChangedEvent(uiControl, eventHandler) '<<<<<<
Catch ex As Exception
'uh oh, control doesn't support
'this event name
eventSubscribed = False
End Try
End If
Return eventSubscribed
End Function
End Sub
Private Sub SubscribeToChangedEvent(ByVal uiControl As Control, ByVal eventHandler As EventInfo)
'details removed
End Sub