Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.

PRB: XML Web Service Created with ASP.NET Does Not Support Multidimensional Arrays

View products that this article applies to.

This article was previously published under Q316273

↑ Back to the top


When you try to obtain a Web Services Description Language (WSDL) document from a Web service by using a Web service method that contains a return type or parameter type that is a multidimensional array, you receive the following HTML error message:
Cannot serialize object of type System.String[,]. Multidimensional arrays are not supported.
An exception is generated if you call the Web Service.

↑ Back to the top


XML Web services that are created with ASP.NET do not support multidimensional arrays.

↑ Back to the top


Instead of using multidimensional arrays, use the following code to specify an array of arrays (in other words, a jagged array):
Visual C# .NET example:

public string[][] ReturnMultiDimArray() 
  string [] y = {"ab","cd"};
  string [] z = {"ef","gh"};			
  string [][] x = {y,z};			
  return x;

Visual Basic .NET example:

<WebMethod> Public Function ReturnMultiDimArray() As String()()
  Dim y As String()
  Dim z As String()
  Dim x As String()() = New String()() {y, z}
  Return x
End Function

↑ Back to the top

More information

This behavior is by design.

↑ Back to the top

Keywords: KB316273, kbprb

↑ Back to the top

Article Info
Article ID : 316273
Revision : 9
Created on : 2/11/2004
Published on : 2/11/2004
Exists online : False
Views : 466