Option 1
If you have an array of string
s, then you can use String.Join
:
string[] values = ...;
string concatenated = string.Join(",", values);
Option 2
If you’re dealing with an array of any other type and you’re using .NET 3.5 or above, you can use LINQ:
string concatenated = string.Join(",",
values.Select(x => x.ToString()).ToArray());
Related Contents:
- What is an IndexOutOfRangeException / ArgumentOutOfRangeException and how do I fix it?
- How do I encode and decode a base64 string?
- Get installed applications in a system
- MVC Form not able to post List of objects
- How can I protect my .NET assemblies from decompilation?
- Can a Byte[] Array be written to a file in C#?
- Overlapping matches in Regex
- Accessing MVC’s model property from Javascript
- Can I find out the return value before returning while debugging in Visual Studio?
- Dynamically Created Controls losing data after postback
- Convert a binary string representation to a byte array
- How to change XML Attribute
- How to get ASCII value of string in C#
- Entity framework left join
- Sort ObservableCollection through C#
- Classes residing in App_Code is not accessible
- C# ASP.NET Single Sign-On Implementation
- To return IQueryable or not return IQueryable [closed]
- How can I sort a string of text followed by a number using LINQ
- WPF MessageBox window style
- Localization of DisplayNameAttribute
- How to update the value stored in Dictionary in C#?
- How to mock an async repository with Entity Framework Core
- Can bindings create memory leaks in WPF?
- C# hashcode for array of ints
- Efficiently get full json string in JsonConverter.ReadJson()
- Fake-scrolling containers with very many controls
- Casting vs Converting an object toString, when object really is a string
- Declaration of Anonymous types List [duplicate]
- C# code to linkify urls in a string
- Client is unauthorized to retrieve access tokens using this method Gmail API C#
- Differences between a multidimensional array “[,]” and an array of arrays “[][]” in C#?
- Using LINQ to concatenate strings
- Workaround for the WaitHandle.WaitAll 64 handle limit?
- How to avoid multiple instances of windows form in c#
- How to set json serializer settings in asp.net core 3?
- Deserializing JSON array into strongly typed .NET object
- Determine Label Size based upon amount of text and font size in Winforms/C#
- How do I automate SAP GUI with c#
- How to hide wpf datagrid columns depending on a property
- Display picture box faster
- Opening a “known file type” into running instance of custom app – .NET
- The imported project “C:\Microsoft.CSharp.targets” was not found
- How do I set `OutputPath` in a Visual Studio 2017 project (new .csproj file format) without the target framework cluttering the resolved path?
- Finding property differences between two C# objects
- Binding ComboBox SelectedItem using MVVM
- How to make EF-Core use a Guid instead of String for its ID/Primary key
- Optimistic concurrency: IsConcurrencyToken and RowVersion
- Irregular shaped Windows Form (C#)
- Wrapping ManualResetEvent as awaitable task