Si tu veux juste récupérer la propriété par son nom :
Code VB.NET : Sélectionner tout - Visualiser dans une fenêtre à part Dim props As PropertyInfo() = p.GetType().GetProperties().Where(Function(p) p.Name = "PersonId").ToArray()
Si tu veux récupérer une propriété par son nom et si elle a l'attribut :
Code VB.NET : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7 Dim prop = GetType(TestDTO) _ .GetProperties() _ .Where(Function(p) _ p.GetCustomAttributes(GetType(TypePropertyAttribute), False) IsNot Nothing _ AndAlso p.Name = "PersonId") _ .Select(Function(p) p) _ .FirstOrDefault()
Partager