In my application (WinForms), I have a dll referenced as a namespace (similarities). I want to call the methods via Invoke, but it throws me an "Object does not match target type".
In the .dll, there is in my class "similarities" for example following function (here only the definition):
Public Function Simil(ByVal String1 As String, ByVal String2 As String) As Single
[...]
End Function
In my application, I use reflection this way (in real, it is a For-loop through an array of strings) and the last line throws me the error:
Dim magicMethod As Reflection.MethodInfo
Dim methode As String = "Simil"
Dim points As Integer
Dim s1 As String = "string 1"
Dim s2 As String = "string 2"
magicMethod = GetType(similarities).GetMethod(methode)
points = CInt((magicMethod.Invoke(methode, {s1, s2})) * 100)
What do I have to change?
Aucun commentaire:
Enregistrer un commentaire