string.Join() の練習

Xamarin Studio を使いながら、C# の勉強をしています。

using System;
using System.Collections.Generic;

namespace Example {
    class MainClass {
        public static void Main(string[] args) {
            int[] xs = { 3, -23, 4, 32 };
            List<int> ys = new List<int>() { 889, 22, 4 };
            Dictionary<int, string> d = new Dictionary<int, string>() {
                { 1, "foo" },
                { 90, "bar" }
            };

            Console.WriteLine(string.Join(",", xs));
            Console.WriteLine(string.Join("|", ys));
            Console.WriteLine(string.Join("<>", d));
        }
    }
}

実行結果です。

3,-23,4,32
889|22|4
[1, foo]<>[90, bar]