PropertyInfo.value TypeMismatchException

I have a PropertyInfo structure for a class property (in this case the property is a Int64()). The following assignment raises a TypeMismatchException. The exception error code is 0 and the message is empty.

Dim pArray() As Variant = pInfo.Value(parentObject)

When I assign the value to a single variant it works and when I look at “v” in the debugger it shows it as a Int64().

Dim v As Variant = pInfo.Value(parentObject)

I’m trying to get this assigned to an array pointer/reference so I can loop through the values. Any ideas?

Why use a Variant?

Dim pArray() As UInt64 = pInfo.Value(parentObject)

Thanks for responding Andrew. There is no guaranty the incoming argument will be an Int64(). That just happened to be the first array property the function came across. It looks I may have to create another layer here that looks at the property’s type and returns the appropriate array type.