tags:

views:

89

answers:

2

C#
It's possible to set to a variant this sentence {"D", and receive precisely the same string. I try some variants, for sample:

1) "{""D""," = "End of expression expeted" error;  
2) @"{""D""," = "{\"D\","

Any suggestions?

+2  A: 

I believe the second suggestion is the one you want. The slashes in the output are displayed there by VS for clarity. The string is actually {"D".

Tor Haugen
A: 

Simply do:

string S = "{\"D\",";

In other words, " can be escaped by \.

Vilx-