简体   繁体   中英

can't serialize object type System.Double[,]?

hello again i finally finish my web service and client and it works fine from the client side how ever when i try to acces de server from my web browser i receive the error can't serialize object type System.Double[,] No support multidimensional arrays. I think it's due to my webmethod return a multidimensional array, how ever i need to return this array, con someone help try to solve this error or how to work aroudn it note: i am usign C#, asp.net. IIS, write in the NotePad, not using visual studio

Reencode your data as double[][]

Here's a method do do it:

public static T[][] ConvertToJaggedArray<T>(T [,] multiArray)
{
  int numOfColumns=multiArray.GetLength(0);
  int numOfRows=multiArray.GetLength(1);
  T[][] jaggedArray = new T[numOfColumns][];

  for (int c = 0; c < numOfColumns; c++)
  {
      jaggedArray[c] = new T[numOfRows];
      for (int r = 0; r < numOfRows; r++)
      {
          jaggedArray[c][r] = multiArray[c, r];
      }
  }

  return jaggedArray;
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM