I have list like...
List[0] = "Banana"
List[1] = "Apple"
List[2] = "Orange"
I want to produce output as "My-Banana,My-Apple,My-Orange"
for that I'm using the following code:
string AnyName = string.Join(",", Prefix + List));
But not getting the expected output, how to add My- before every item?
Are you looking for something like this Example:
listInput[0] = "Apple";
listInput[1] = "Banana";
listInput[2] = "Orange";
string Prefix = "My-";
string strOutput = string.Join(",", listInput.Select(x=> Prefix + x));
Console.WriteLine(strOutput);
And you will get the output as My-Apple,My-Banana,My-Orange
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With