Friday, July 22, 2022

c# - How convert string array into one string

If you use this code on string array:
string[] args = Environment.GetCommandLineArgs();      
Console.Write( args.ToString() );
you will get:
System.String[]
But better way in this case is to use string.Join() function (where you can set used delimiter):
string[] args = Environment.GetCommandLineArgs();      
Console.Write( string.Join( ",", args ) );
Then:
C:\app.dll,layoutdir=C:/app/bin

No comments:

Post a Comment