To Csv - CSharp System

CSharp examples for System:String Format

Description

To Csv

Demo Code


using System.Text;
using System.Linq;
using System.Collections.Generic;
using System;/*from  w  w w. ja v  a2s . c  om*/

public class Main{
        public static string ToCsv(object[] strings)
        {
            if (strings == null) return string.Empty;

            var sb = new StringBuilder();
            for (int i = 0; i < strings.Length; i++)
            {
                if (i > 0)
                {
                    sb.Append(", ");
                }
                sb.Append(strings[i]);
            }
            return sb.ToString();
        }
}

Related Tutorials