Johnny Johnny - 1 year ago 99
C# Question

How to extract specific column from 2D array

Updated please review ,r ohin's answer ty

Answer Source
    var column = 2; // your expected column
    //if it needs to be dynamic, you can read it from user entry
    // Console.Write("Enter expected column: ");
    // column = int.Parse(Console.ReadLine()); //enhance with error checks
    for (int row = 0; row < r; row++)
        Console.Write(matrix[row, column] + " ");
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download