BitShift

What is wrong with this
string fred = @"< xml version="1.0" >";



Re: Visual C# Language string literal - whats wrong ?

micvos

It should read:

string fred = @"< xml version=""1.0"" >";

Altough the @ is used for string literals it doesn't work for the " character or otherwise the compiler can't determine when the string ends.






Re: Visual C# Language string literal - whats wrong ?

TilakGopi

Hi,

If i'm not wrong, there is no need @ at the strarting of string fred value.

Almost all xml document elements will be in the format

< xml version="1.0" >.Then where can we find the use of the symbol '@'.

If u use any '\' in the string ,then u can use '@' symbol to take it as it is '\' ,otherwise u need to put '\\'.That's one use of @ ,i knew.

What situation made u put that symbol there,may i know

Thanx,

Ch.T.Gopi Kumar.






Re: Visual C# Language string literal - whats wrong ?

Bashmohandes

You can also do this
string fred = "< xml version=\"1.0\" >";
remove the @ and add before each " the character \