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
Related Q & A:
- How to drop all connections to a specific database in postgres without stopping the server?Best solution by Database Administrators
- how to display .pgm image on a JFrame?Best solution by Stack Overflow
- How to open flash projector on a specific screen?Best solution by stackoverflow.com
- How to return multiple objects of a specific library in R?Best solution by Stack Overflow
- How can I find pictures of a specific unknown person?Best solution by Yahoo! Answers
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
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.