C# to COM interop call returning an array of objects.

  • Thread starter Thread starter Interop newbie
  • Start date Start date
I

Interop newbie

Hello,

The following code makes an interop call to a Com object
from C#:


//Create a Bom object
NewsBusObjsRCW.NewsBomObjClass myNewsBom = new
NewsBusObjsRCW.NewsBomObjClass();

//Get the parts array
NewsBusObjsRCW.NewsPartObjClass[] myNewsPartArray =
myNewsBom.theNewsLocObject.theNewsRevObject.theNewsPartObje
ctArray;


When I do a build I get the following error:

Property, indexer, or event 'theNewsPartObjectArray' is
not supported by the language; try directly calling
accessor
methods 'NewsBusObjsRCW._NewsRevObj.get_theNewsPartObjectAr
ray()'
or 'NewsBusObjsRCW._NewsRevObj.set_theNewsPartObjectArray
(ref NewsBusObjsRCW.NewsPartObj[])'


The interop calls work fine for other attributes of the
NewsRevObj (the following code works fine):

string myName =
myNewsBom.theNewsLocObject.mtheNewsRevObject.theName


There is a problem with returning an array of objects.
Can anyone help me out with this?

Thanks,
Dave
 
Man, this message looks like Deja Vu. I could have sworn I've seen it here
before. Do a search on Google groups and I'll bet money that you find your
answer.

Pete
 
Dave,

So did you try what was suggested in the error message?

NewsBusObjsRCW.NewsPartObjClass[] myNewsPartArray =
myNewsBom.theNewsLocObject.theNewsRevObject.get_theNewsPartObjectArray();



Mattias
 
Back
Top