Which of these is a valid path declaration?
-
string s="c:\abc.txt";
-
string s="c:/abc.txt";
-
string s=@"c:\abc.txt";
-
All are correct
D
Correct answer
Explanation
C# supports multiple path declaration formats. Double backslash escapes the backslash character (c:\abc.txt becomes c:\abc.txt at runtime). Forward slashes work in Windows paths (c:/abc.txt). Verbatim string literals using @ prefix treat backslashes literally (@"c:\abc.txt"). All three syntaxes are valid C# string declarations for file paths.