[Mono-devel-list] problems with Reflection and private f
Varga Zoltan
vargaz at freemail.hu
Fri Oct 17 13:00:53 EDT 2003
Try:
BindingFlags.NonPublic|BindingFlags.Instance
Zoltan
Leonardo S. <leods at cwazy.co.uk> írta:
> I have problems retrieving private fields with reflection.
I wrote a
> small class with 2 private fields, and then try to print
their names
> using reflection. The problems is, the method GetFields()
returns an
> empty array. The class is this:
>
> using System;
> using System.Reflection;
>
> public class Borrar
> {
> int attrib1;
> string attrib2;
>
>
> public static void Main(string[] args)
> {
> Type type = typeof(Borrar);
> FieldInfo[] info = type.GetFields();
>
> foreach (FieldInfo i in info)
> {
> Console.WriteLine("----> " + i.Name);
> }
>
> }
> }
>
>
> I've also tried using
type.GetField(BindingFlags.NonPublic) with the
> same result.
>
> Thanks!
> --
> :: Leonardo S. De Seta
>
> _______________________________________________
> Mono-devel-list mailing list
> Mono-devel-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-devel-list
>
>
>
More information about the Mono-devel-list
mailing list