How can display multiple values to single column?

How to display all values in a SPECIFIC row of an array in C#?

  • Hello, I am new with arrays. I have a multidimensional array and I am trying to write a method that asks the user which row they want to view, and then display ALL the values to the end of the column.

  • Answer:

    Assuming you don't know the dimensions of the array, you're going to write something like: void DisplayRow(int[,] ar, int row) { for (var i = 0 ; i < ar.GetLength(1) ; i++) { Console.Write("{0} ", ar[row, i]); } Console.WriteLine(); } Depending on your terminology, GetLength(1) might be GetLength(0) and ar[row, i] might need to be ar[i, row].

peteams at Yahoo! Answers Visit the source

Was this solution helpful to you?

Related Q & A:

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.