cast using reflection

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi all

I have an object created via reflection of type CateringObject.FBO. I'm trying to assign it to a property that accepts objects of type CateringObject.IDeliveryDestination (which is implemented by CateringObject.FBO). When I try to set the property to an object of type FBO, I get a bad type error. Using reflection, how do I cast the FBO object to IDeliveryDestination? Any advice would be very appreciated

Code snippet included below

Thank
Cha

Type* IDeliveryDestinationType = myAssembly->GetType(S"CateringObjects.IDeliveryDestination", true)
Type* fboType = myAssembly->GetType(S"CateringObjects.FBO", true)
MethodInfo* pfnGetFBOByID = fboType->GetMethod(S"GetFBOByID")

Object* fboParams[] = {connectionString, __box(destinationID)}
Object* FBO = pfnGetFBOByID->Invoke(fboType, fboParams)

//error on this line, Object does not match target typ
orderInstance_DeliveryDestination_Property->SetValue(orderInstance, FBO, NULL);
 
Nevermind. All that effort researching the wrong problem...turned out to be a typo.

Chad
 
Back
Top