Cannot serialize object of type System.Object[,]. Multidimensional arrays are not supported

J

john harkin

Hi,
Thanks very much for this and it worked.
I'm actually need to retun an object which could contain object[][].
One thing i notice


[WebMethod]
public object ReturnJaggedArrayAsObject()
{
object[][] numbers = new object[2][] { new object[] {2,"string1",
24.56}, new object[] {4,"string2", 56.78} };
object a = (object) numbers;
return a;

}

didn't work and got a serialisation error but when i added

[WebMethod]
public object[][] Fred()
{
object[][] numbers = new object[2][] { new object[] {2,"string1",
24.56}, new object[] {4,"string2", 56.78} };

return numbers;

}

to the source file i was able to call ReturnJaggedArrayAsObject.
It appears that by having Fred it knows about object[][] in wsdl.
Any way of achieving this without defining Fred?

Regards


Christoph Schittko said:
You can return jagged arrays, i.e.

System.Object[][] instead of System.Object[,].

HTH,
Christoph Schittko
MVP XML
http://weblogs.asp.net/cschittko
-----Original Message-----
From: john harkin [mailto:[email protected]]
Posted At: Tuesday, September 21, 2004 2:58 AM
Posted To: microsoft.public.dotnet.framework.aspnet.webservices
Conversation: Cannot serialize object of type System.Object[,].
Multidimensional arrays are not supported
Subject: Cannot serialize object of type System.Object[,].
Multidimensional arrays are not supported

Hi,
I get this on server when trying to retun a 2 dim array.
I apprecaite that they are not supported as per
http://support.microsoft.com/default.aspx?scidkb;en-us;316273

however i'm looking for as a work around as my web service is a layer
in front of an existing com object which cannot be changed and it
returns the 2 dim array.

All thoughts welcome.

JOhn

--
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,236
Members
46,825
Latest member
VernonQuy6

Latest Threads

Top