Introspection Value question

Hello

I’m testing the introspection, and came across something weird. I want to get the Value of a Property using Introspection. The code is this:

[code]Dim introInfo As Introspection.TypeInfo
introInfo = Introspection.GetType(thisSystemSettings)

For Each currentPropertyInfo As Introspection.PropertyInfo In introInfo.GetProperties
Dim test As Object = currentPropertyInfo.Value(thisSystemSettings)
Next[/code]

Why is it necesary to do currentPropertyInfo.Value(INSTANCE) when I already defined the Instance in introInfo (Introspection.GetType(INSTANCE))
Isn’t that useless? It would be very weird to get PropertyInfo from a certain Instance, but the Value of a totally other Object/Instance, no?

If somebody knows why it is handled this way, please tell me!

Thanks

You are getting TypeInfo of a class. The instance is just a convenient way to access the class without having to know the class itself up front, but there is no difference between Introspection.GetType( InstanceOfMyClass ) and GetTypeInfo( MyClass ).

Once you have that TypeInfo, you can apply it against any instance of that class, so you have to specify the instance that interests you. For example, suppose you had an array of MyClass. You would only need to get the TypeInfo once, then apply it against every element of the array.

Thanks for the clear answer!