I need to pass a string with type A,B,C,D,E(Separated with comma) in each string[] value.
String Test ="A,B,C,D,E";
string[] arr1 = new string[5];
I need to pass a string with type A,B,C,D,E(Separated with comma) in each string[] value.
String Test ="A,B,C,D,E";
string[] arr1 = new string[5];
Use .Split()
string[] arr1 = Test.Split(',');
If you want to insert this string into a string[]
with size 5:
string[] arr1 = Enumerable.Repeat(Test, 5).ToArray();
of course the classic way is to use a for-loop:
string[] arr1 = new string[5];
for(int i = 0; i < arr1.Length; i++)
arr1[i] = "A,B,C,D,E";
If you instead want to create a string[]
from the string:
string[] arr1 = "A,B,C,D,E".Split(',');