为什么?找不到方法:'Void System.Collections.Generic.Dictionary`2.System.Collections.Generic.ICollection <tkey> .Add(!0)'</tkey>

时间:2011-03-07 19:02:38

标签: vb.net reflection

我在标有“&lt;&lt;&lt;&lt;”

的行上收到以下错误
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

0 个答案:

没有答案