Help : Whats the "@" in the directory info call.

  • Thread starter Thread starter Krish
  • Start date Start date
K

Krish

public static void Main()
{
try
{
DirectoryInfo di = new DirectoryInfo(@"c:\");

// Get only subdirectories that contain the letter "p."
DirectoryInfo[] dirs = di.GetDirectories("*p*");

Console.WriteLine("Number of directories with a p: {0}",
dirs.Length);

// Count all the files in each subdirectory that contain
the letter "e."
foreach (DirectoryInfo diNext in dirs)
{
Console.WriteLine("The number of files in {0} with an
e is {1}", diNext,
diNext.GetFiles("*e*").Length);
}
}
catch (Exception e)
{
Console.WriteLine("The process failed: {0}",
e.ToString());
}
}
 
It just means that the following string is a literal, so that characters
like '\' aren't treated as escape characters, but as what they are.
 
Marina said:
It just means that the following string is a literal, so that characters
like '\' aren't treated as escape characters, but as what they are.

Slight correction there - it means it's a *verbatim* string literal.
Anything like "hello" is a literal.

A Google search for "verbatim string literal" provides more
information.
 
Back
Top