Very simple but completely stumped...

  • Thread starter Thread starter Aravind @Office
  • Start date Start date
A

Aravind @Office

Hello Everyone

What will following string contains thru this assignment
string strList = "\"" + "test" + "\"";

If the result is \"test\" then what should I do to get "test". This seems
so basic but I am really confused with all different languages (c/c++/java
and c#).


Thanks
Aravind
 
Aravind @Office said:
Hello Everyone

What will following string contains thru this assignment
string strList = "\"" + "test" + "\"";

It will contain "test" (with the quotation marks).
 
Hello John

That is what I was expecting. But I got \"test\". This confused me a lot
and hence the post. However after your response, I tried it again and I got
the result as expected (as you have mentioned). Only thing that changed
was, VS gave one of those windows error which gives us a option to send an
error report to MS. After that I was positively seeing this error and I
spent almost half hour before giving up and then rebooted the computer and
used StringBuilder to build my string. So I am thinking something got out
of wack.

Anyway what is the chance of something like this happen while the code is
running?
Thanks for the reply though.

aravind.
 
Aravind @Office said:
Hello John

That is what I was expecting. But I got \"test\". This
confused me a lot
and hence the post. However after your response, I tried it
again and I got
the result as expected (as you have mentioned).

If you look at the value of the variable in debug mode then the
value will appear to be \"test\", however that is only display
for the developer. The actual value of the variable is "test",
and anywhere it is used it will be "test".

Andrew Faust
 
Back
Top