Type.GetFields returning twice each field ...

  • Thread starter Thread starter DDE
  • Start date Start date
D

DDE

Hi,

I have defined he following class:
public class ContactInfo {
public string con_nom;
public string con_prenom;
public string con_fonction;
public string con_email;
}

When I use the following code, I get each field twice, whatever I use as
BindingFlags:

Type theType = typeof(ContactInfo);
theFields = theType.GetFields(BindingFlags.Instance|BindingFlags.Public);

foreach ( FieldInfo field in theFields ) {

Console.WriteLine(field.Name+" "+field.FieldType+" "+field.Attributes);

}

What's going wrong here?

Thanks, Dominique
 
I can't reproduce your results. using your code I get each field once. Can
you post a fully working example....

Regards
Lee
 
Well, not so easy, my code is part of a Web Service. I'll try to reproduce
the problem in a simple app.

Thanks
Dominique
 
Back
Top