Created
November 9, 2018 11:39
-
-
Save Et7f3/95da33af7f500c8b0c78188fc1e4aa1a to your computer and use it in GitHub Desktop.
array to string
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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