Skip to content

Instantly share code, notes, and snippets.

@Et7f3
Created November 9, 2018 11:39
Show Gist options
  • Save Et7f3/95da33af7f500c8b0c78188fc1e4aa1a to your computer and use it in GitHub Desktop.
Save Et7f3/95da33af7f500c8b0c78188fc1e4aa1a to your computer and use it in GitHub Desktop.
array to string
using System;
using System.Linq;
namespace Outils {
class intArrayToString {
static void Main(string[] args) {
Console.WriteLine("{0}", deepToString(new int[][]{new int[]{5}, new int[]{5}, new int[]{5}}));
Console.ReadLine();
}
static string deepToString(int[][] a)
{
return "[" + String.Join(",", a.Select(p => toString(p)).ToArray()) + "]";
}
static string toString(int[] a)
{
return "[" + String.Join(",", a.Select(p => p.ToString()).ToArray()) + "]";
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment