Failing to set a default value to a List of String

Hey everyone.

I’m trying to initialize some String values in my list of Strings for testing purposes. However, it won’t work. Here’s the screenshot:

As you can see, it says “End of expression expected”, and I can’t figure out why, because the only value of my list of strings is in between double quotes. Also, deleting the “@” symbol makes the error be “String constants must end with a double quote”. Any ideas?

Thanks in advance.

Try using this expression:

new List (Of String) from {chr(34) + "yourString" +chr(34)}

Best,
Charbel

1 Like

Thank you for your help, unfortunately, this didn’t work

Hi,

Which language do you use, VB or C#? Your expression seems it mixed.

VB (VB doesn’t support @ and need to use vbcrlf as linebreak)

New List(Of String)From{"ABC"+vbcrLF+"DEF"+vbcrlf+"GHI"}

C#

new List<string>(){@"ABC
DEF
GHI"}

Regards,

2 Likes

Ah, thanks again Yoichi.
I am using VB indeed. I didn’t think it wasn’t possible because that’s how the string appeared in the locals value in debug mode. Cheers!

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.