what does this mean?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mrcw
    New Member
    • Nov 2008
    • 82

    #1

    what does this mean?

    Hi

    I'm trying to work out what this is doing

    int[,] kernel = { { -1, -1, -1 }, { -1, 8, -1 }, { -1, -1, -1 } };
    int ksize = kernel.GetLengt h(0);


    What I think is happening is:

    The first line declares a dynamic multidimensiona l array of integers called kernal and puts the values { -1, -1, -1 }, { -1, 8, -1 }, { -1, -1, -1 } in it (3 rows of 3).
    The second line declares an int called ksize and puts the length of kernal into it.

    But is the length of kernal 3 or 9?
    and what is (0) on the kernel.GetLengt h(0) used for?

    mrcw
  • Banfa
    Recognized Expert Expert
    • Feb 2006
    • 9067

    #2
    Is this by any chance C#?

    Although quite C like it is certainly not C or C++.

    Comment

    • mrcw
      New Member
      • Nov 2008
      • 82

      #3
      Sorry put it in wrong place

      Comment

      • tlhintoq
        Recognized Expert Specialist
        • Mar 2008
        • 3532

        #4
        Rather than tell you the answer how about if we show you a way to learn the answers?

        But is the length of kernal 3 or 9?
        Code:
        int ksize = kernel.GetLength(0);
        Check/display the value of ksize in your application. You could have a messagebox show you the value:
        Code:
        MessageBox.Show(ksize.ToString(), "The value is...");
        what is (0) on the kernel.GetLengt h(0) used for?
        Whenever you want to know something about the .NET framework a good place to start is the MSDN. For this question specially you can find the answer here:
        http://msdn.microsoft.com/en-us/libr...getlength.aspx

        Comment

        • mrcw
          New Member
          • Nov 2008
          • 82

          #5
          already figured out that was thig to do

          Comment

          Working...