Probleme de reflexion avec GetProperties
Salut
Voici mon code de test :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13
|
foreach (PropertyInfo pi in typeof(test).GetProperties(BindingFlags.DeclaredOnly | BindingFlags.Public | BindingFlags.Instance | BindingFlags.GetProperty | BindingFlags.SetProperty))
{
string name = pi.Name;
}
public class test
{
public string P1 { get; set; }
private string P2 { get; set; }
public string P3 { get; private set; }
public string P4 { private get; set; }
} |
Je ne comprends pas pourquoi je recupere P1, P3 et P4 ... je m attend a seulement recuperer P1.
Pour la PropertyInfo de P4 CanRead et CanWrite sont a true ?!?
Merci d avance