Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
String literal in multiple lines in C#
Message
De
22/04/2007 05:40:34
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
 
À
22/04/2007 05:35:34
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Versions des environnements
Environment:
C# 2.0
Divers
Thread ID:
01218662
Message ID:
01218664
Vues:
17
>I have long single line string literals containing " characters in code like
>
>switch (expr) {
> case @"IR(""xxx"")+sql('sele tasudok from dok x where doktyyp+str(dokumnr,7)= ""G""+str(dok.krdokumnr,7) ','')":
>
>For code readability I need to split them to multiple lines so that vlaue remains same. I tried
>
>switch (expr) {
> case "IR(\"xxx\")+\
>sql('sele tasudok from dok x \
>where doktyyp+str(dokumnr,7)= \"G\"+\
>str(dok.krdokumnr,7) ','')":
>
>But got compile error. Any idea ?

Use @ prefix.
PS: In most cases it's easier to use StringBuilder.
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform