lundi 11 janvier 2021

How get methods from a specific namespace?

Namespace App1
    Public Class Apple
        Inherits Fruit

        Public Overloads Sub Eat(food As Food)

        End Sub
    End Class
End Namespace
Public Class Apple
    Inherits Fruit

    Public Overloads Sub Eat(food As Food)

    End Sub
End Class
Public Class Food
    '...
End Class
Public Class Fruit
    Implements IFood
    Public Overridable Function Eat(ByVal eatController As Food) As Boolean Implements IFood.Eat
        Throw New NotImplementedException
    End Function
End Class
Public Interface IFood
    Function Eat(ByVal eatController As Food) As Boolean

End Interface

Dim someFood As App1.Fruit= Nothing

Dim foodType As System.Type = someFood.GetType()'I am seeing the correct namespace when debugging

For Each data As MethodBase In foodType .GetMethods()
    'I make use of `ParameterInfo` here
    ' I can see the methods from the class `Apple`without the namespace. I would like the method from the class with namespace App1 only'
next

How can I get methods from only one class with specific namespaces only?





Aucun commentaire:

Enregistrer un commentaire