Reflection ArrayList

E

Elmer Miller

Hello,
ArrayList a = new ArrayList();
Type t = a.GetType();
FieldInfo[] InnerList =t.GetFields(BindingFlags.Public |
BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly);


When the above code runs on Compact Framework we get three items: (_items,
_size, _version)
But when you run the code on full framework you get 4 items (_items,
_size,_version,_syncRoot)

I can't figure out why reflection can't see the syncRoot becacuse this
should be supported on the CF.
Any ideas???
 
T

Tim Wilson

Reflection cannot see it because it's not actually there. If you look at the
definition for ArrayList in a utility such as Reflector or ildasm you can
see that in the full framework all four items are there but in the compact
framework only the three items that you listed are present.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top