How to print Collection List!

How to print collection list? not using for each.
I need entire collection list like[ ‘abc’, bcd,…]

2 Likes

Fine
its possible like this
“[”+String.Join(",",Listvariable)+"]"

Cheers @KarthikBallary

5 Likes

I want full collection list not one by one.
for exmple myList is a type of collection
if I print MyList.toString it must print all data present in collection

2 Likes

yah it would actually
kindly try once and let know please
the output would be like
[value1, value2,…,valuen]

Cheers @KarthikBallary

3 Likes

@Palaniyappan 's solution does the right thing, just try it

Another thing you can do is print the JSON-Representation of it:

JsonConvert.SerializeObject(MyCollection,Newtonsoft.Json.Formatting.Indented)

If you want to use the JSON-Version don’t forget to import Newtonsoft.JSON
image

its not coming like tht
[System.Collections.Generic.List`1[System.String]]

Ok k now I got it thanks

1 Like

Great
Cheers @KarthikBallary

what if I need [“value1”, “value2”, etc etc]

1 Like

same
like this
“[”+String.Join(",",Listvariable)+",etc"+"]"

Cheers @KarthikBallary

etc is just example

May i know how we need that completly
may be with a sample
Cheers @KarthikBallary

there might any number of variables

[“vaue1”,“value2”,“value3”,“value4”]

1 Like

values are the data from collection list

1 Like

That doesnt matter how many values are there
this expression will concatenate all of them
“[”+String.Join(",",Listvariable)+",etc"+"]"

Cheers @KarthikBallary

So did that work buddy
Cheers @KarthikBallary

Hello @KarthikBallary
First Assign this Value to a string Variable
StringVariable=String.Join(" ",YourListName)
than Re assign this value to that String Varibale
"["""+System.Text.RegularExpressions.Regex.Replace(Strr,"\s+",""",""")+"""]"

you’ll get the desired output
Check this workflow for better understanding
RegexSplit.xaml (5.2 KB)

2 Likes

no I mean to add “” to that values

In simple word pls tell me how to pass list to pyScript