469,599 Members | 2,862 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,599 developers. It's quick & easy.

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

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.theNew sPartObje
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_theNewsPartObjectA r
ray()'
or 'NewsBusObjsRCW._NewsRevObj.set_theNewsPartObjectA rray
(ref NewsBusObjsRCW.NewsPartObj[])'
The interop calls work fine for other attributes of the
NewsRevObj (the following code works fine):

string myName =
myNewsBom.theNewsLocObject.mtheNewsRevObject.theNa me
There is a problem with returning an array of objects.
Can anyone help me out with this?

Thanks,
Dave

Nov 15 '05 #1
2 2148
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

"Interop newbie" <an*******@discussions.microsoft.com> wrote in message
news:04****************************@phx.gbl...
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.theNew sPartObje
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_theNewsPartObjectA r
ray()'
or 'NewsBusObjsRCW._NewsRevObj.set_theNewsPartObjectA rray
(ref NewsBusObjsRCW.NewsPartObj[])'
The interop calls work fine for other attributes of the
NewsRevObj (the following code works fine):

string myName =
myNewsBom.theNewsLocObject.mtheNewsRevObject.theNa me
There is a problem with returning an array of objects.
Can anyone help me out with this?

Thanks,
Dave

Nov 15 '05 #2
Dave,

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

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

Mattias

--
Mattias Sjögren [MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/
Please reply only to the newsgroup.
Nov 15 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Nadav | last post: by
4 posts views Thread by C# beginner | last post: by
1 post views Thread by Brendan Grant | last post: by
reply views Thread by suresh191 | last post: by
4 posts views Thread by guiromero | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.