Array.Join in .Net?

后端 未结 7 813
挽巷
挽巷 2020-12-10 10:26

Ok, this is a dumb thing that I\'m sure I\'ve done dozens of times but for some reason I can\'t find it.

I have an array... And want to get a string with the content

7条回答
  •  我在风中等你
    2020-12-10 11:10

    It is on the string class

    String.Join(",", new string[] {"a", "b", "c"});
    

    Edit for ints to string

     int[] integers = new int[] { 1,2,3,4,5 };
     String.Join(",", Array.ConvertAll(integers, Convert.ToString));
    

提交回复
热议问题