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

Discussion in 'ASP .Net Web Services' started by john harkin, Sep 21, 2004.

  1. john harkin

    john harkin Guest

    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?scid=kb;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
    john harkin, Sep 21, 2004
    #1
    1. Advertising

  2. john harkin

    john harkin Guest

    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 [MVP]" <> wrote in message news:<#$>...
    > 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:]
    > > 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

    >
    > --
    john harkin, Sep 23, 2004
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Gordz
    Replies:
    3
    Views:
    3,918
    John Oakes
    Jun 7, 2004
  2. Imran Aziz
    Replies:
    4
    Views:
    8,653
    ljenner01
    Jan 19, 2011
  3. Philipp
    Replies:
    21
    Views:
    1,093
    Philipp
    Jan 20, 2009
  4. Francesco
    Replies:
    2
    Views:
    1,075
    Francesco
    Nov 6, 2009
  5. Robert
    Replies:
    5
    Views:
    887
    阿利
    Apr 20, 2006
Loading...

Share This Page