Mihir Mihir - 1 year ago 76
C# Question

How to convert string to string[]?

How to convert

string
type to
string[]
type in C#?

Answer Source

string[] is an array (vector) of strings string is just a string (a list/array of characters)

Depending on how you want to convert this, the canonical answer could be:

string[] -> string

return String.Join(" ", myStringArray);

string -> string[]

return new []{ myString };
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download