private static int[,] Arr2FromConsole(bool square) { while (true) { try { Console.WriteLine("введите двумерный массив"); StringBuilder sb = new StringBuilder(); string t = ""; do { t = Console.ReadLine(); sb.AppendLine(t); } while (t != ""); int[,] arr2 = Array2Convert.StrToArr2(sb.ToString()); if (square && arr2.GetLength(0) != arr2.GetLength(1)) { throw new Exception("двумерный массив не квадратный"); } return(arr2); } catch (Exception ex) { Console.WriteLine(ex.Message); } } }
private static void Arr2ToConsole(int[,] arr2) { Console.WriteLine(Array2Convert.Arr2ToStr(arr2)); }