Check for 1 or 0 and flip accordingly
if ( matrix [ i , j ] == 1 ) matrix [ i , j ] = 0 ; else matrix [ i , j ] = 1 ; } } } public static int [ ] GetRow ( int [ , ] matrix , int row ) { var rowLength = matrix . GetLength ( 1 ) ; var rowVector = new int [ rowLength ] ; for ( var i = 0 ; i < rowLength ; i ++ ) rowVector [ i ] = matrix [ row , i ] ; return rowVector ; }