M Mike Gleason jr Couturier Jul 8, 2008 #1 Why do I see a @ preceding strings in code examples? What does the @ do? thanks!
M Miro Jul 8, 2008 #2 Do you mean for 'parameters' in sql statements? Can you post an example of what you see?
R Rory Becker Jul 8, 2008 #3 Hello Mike Gleason jr Couturier, Why do I see a @ preceding strings in code examples? What does the @ do? Click to expand... I believe it is a c# sytax that prevents the compiler otherwise interpreting certain characters as escape codes. for example
Hello Mike Gleason jr Couturier, Why do I see a @ preceding strings in code examples? What does the @ do? Click to expand... I believe it is a c# sytax that prevents the compiler otherwise interpreting certain characters as escape codes. for example
A Anthony Jones Jul 8, 2008 #4 Rory Becker said: Hello Mike Gleason jr Couturier, I believe it is a c# sytax that prevents the compiler otherwise interpreting certain characters as escape codes. for example Click to expand... Correct and in addition a string preceded with @ can split across lines:- string someSQL = @" SELECT a.Field1, a.Field2 FROM ATable a INNER JOIN BTable b ON b.ID = a.ID WHERE b.Field3 = 15" The down side is that " need to be duplicated as "" e.g.:- string someXML = @"<root thing=""x"" />"
Rory Becker said: Hello Mike Gleason jr Couturier, I believe it is a c# sytax that prevents the compiler otherwise interpreting certain characters as escape codes. for example Click to expand... Correct and in addition a string preceded with @ can split across lines:- string someSQL = @" SELECT a.Field1, a.Field2 FROM ATable a INNER JOIN BTable b ON b.ID = a.ID WHERE b.Field3 = 15" The down side is that " need to be duplicated as "" e.g.:- string someXML = @"<root thing=""x"" />"
J Jon Skeet [C# MVP] Jul 8, 2008 #5 Mike Gleason jr Couturier said: Why do I see a @ preceding strings in code examples? What does the @ do? Click to expand... See http://pobox.com/~skeet/csharp/strings.html
Mike Gleason jr Couturier said: Why do I see a @ preceding strings in code examples? What does the @ do? Click to expand... See http://pobox.com/~skeet/csharp/strings.html
M Mike Gleason jr Couturier Jul 8, 2008 #6 Ok thanks guys... I was seeing the @ when declaring connection strings in books... (web projetcs, web.config) Thanks!
Ok thanks guys... I was seeing the @ when declaring connection strings in books... (web projetcs, web.config) Thanks!
M Miro Jul 8, 2008 #7 You should also read up on "SQL Injections"... just google it up It will give you good examples of why the @ is used as a parameter.
You should also read up on "SQL Injections"... just google it up It will give you good examples of why the @ is used as a parameter.
G Garfilone Jul 9, 2008 #8 Why do I see a @ preceding strings in code examples? What does the @ do? thanks! Click to expand... with this symbol you could go without escape chars, for example without @: var str="e:\\folder1\\folder2\\folder3\\file" with @: var str=@"e:\folder1\folder2\folder3\file"
Why do I see a @ preceding strings in code examples? What does the @ do? thanks! Click to expand... with this symbol you could go without escape chars, for example without @: var str="e:\\folder1\\folder2\\folder3\\file" with @: var str=@"e:\folder1\folder2\folder3\file"