Click here to Skip to main content
15,906,329 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I'm trying to count non odd numbers in web service matrices.
At the service I made the following method while web services don't support multidimensional arrays, so I have had to make it as a jagged array;
C#
[WebMethod]
        public int AnetaretCift(int [][]cift)
        {
            int [][] matrica = new int [3][];
           int nrcift = 0;
            for (int i = 0; i < matrica.GetLength(0); i++)
            {
                for (int j = 0; j < matrica.GetLength(1); j++)
                {
                    if (matrica[i][j]%2==0)
                    {
                        matrica[i][j]++;
                    }
                    nrcift = matrica[i][j];
                }
            }
            return nrcift;
        }


By the consumer i wrote the following code:
C#
static void Main(string[] args)
      {
          int[][] matrica = new int[3][];
          matrica[0] = new int[3] { 1, 7, 8 };
          matrica[1] = new int[3] { -4, 2, 5 };
          matrica[2] = new int[3] { 4, 5, -3 };
          //{{3, 5, 7},
            //                {4, 6, 2},
              //              {1, 6, -4}};
          referenca.Service1 sherbimi = new referenca.Service1();
          Console.WriteLine("Anetaret cift të matrices jane: " + sherbimi.AnetaretCift(matrica));
          Console.ReadLine();

      }

This code doesn't works by me. If anyone knows how to fix this or what argument I have to give to the web method.
Thank you in advance for your reply.
Cheers.
Posted
Comments
Sergey Alexandrovich Kryukov 17-Jun-15 3:00am    
You did not explain what you want to achieve. Just use the debugger.
—SA
dr_iton 17-Jun-15 3:18am    
I want to count all matrices members that result %2==0.
The consumer does not reaches the web service code even if I made a web service reference.
So I want see the matrices result at the consumer side.
cheers

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900