bonjour ;

voila j'ai un classe nomme Personne
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
 
public Class Personne
{
   private int _PersonneID;
    private string _PersonneName;
 
   public int PersonneID
   {
         get {
                 return _PersonneID;
               }
 
        set{
                _PersonneID=Value;
 
             }
 
  }
 
  public int PersonneName
   {
         get {
                 return _PersonneName;
               }
 
        set{
                _PersonneName=Value;
 
             }
 
  }
 
 
}
est mon code d'appel .

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
 
Personne t = new Personne(); 
            t.PersonneID= 12;
            t.PersonneName = "azstar";
 
                foreach (System.Reflection.PropertyInfo h in t.GetType().GetProperties()  )
                {              
 
 
                    MessageBox.Show(h.PropertyType.ToString());
                    MessageBox.Show(h.Name);
                }
mon probleme est que je n'arrive pas a trouve la valeur de PropertyInfo automatiquement son passe pas t.PersonneID ou t.PersonneName
j'ai essai le PropertyInfo.Getvalue mais il me retourne une exception.

et merci d'avance