Re: Reflection and an overridden class
- From: "Truong Hong Thi" <thi1981@xxxxxxxxx>
- Date: 12 Dec 2005 22:56:47 -0800
Hi John,
>I am aware that the property I am looking for is internal
Yes, but I am not in my first post. You should have mentioned this info
in your original post :)
>For some reason,
>reflection is not picking up the property
It does; have you tried my code above? Actually, I tested it in my
machine (.NET 1.1)
>and I guess it's because I am
>using an inherited class
No. Inherited stuff is included by default. If you want, you can
exclude them by specifying BindingFlags.DeclareOnly
>This procedure does not work. pi
>is null for this case.
No, pi is not null. I tested it. You need to add some rows to the data
grid first:
DataTable table = new DataTable();
table.Columns.Add("text");
table.Columns.Add("text2");
table.Rows.Add(new object[] {"value1", "value2"});
table.Rows.Add(new object[] {"value3", "value4"});
dataGrid1.DataSource = table;
However, if you does not add, it is an empty array, not null.
I use GetProperty instead, but there is no problem with GetMethod. The
only 2 binding flags you need to specify is BindingFlags.NonPublic |
BindingFlags.Instance, but it still works if you specify more as in
your snippet. I cannot reprocude the behavior (pi/mi is null).
Thi
.
- References:
- Reflection and an overridden class
- From: John Richardson
- Re: Reflection and an overridden class
- From: Truong Hong Thi
- Re: Reflection and an overridden class
- From: Truong Hong Thi
- Re: Reflection and an overridden class
- From: John Richardson
- Reflection and an overridden class
- Prev by Date: Re: Why use the DataTableMapping in SqlDataAdapter when updating?
- Next by Date: Re: Refreshing the desktop wallpaper
- Previous by thread: Re: Reflection and an overridden class
- Next by thread: Help me!!!!
- Index(es):
Relevant Pages
|
Loading