What does @"../.." mean in a path?

Xel picture Xel · Feb 22, 2012 · Viewed 39.5k times · Source

I am following this tutorial from MSDN.

There's something I saw in the code that I can't understand

    private void PopulateTreeView()
    {
        TreeNode rootNode;

        DirectoryInfo info = new DirectoryInfo(@"../.."); // <- What does @"../.." mean?
        if (info.Exists)
        {
            rootNode = new TreeNode(info.Name);
            rootNode.Tag = info;
            GetDirectories(info.GetDirectories(), rootNode);
            treeView1.Nodes.Add(rootNode);
        }
    }

Answer

manojlds picture manojlds · Feb 22, 2012

@ is for verbatim string, so that the string is treated as is. Especially useful for paths that have a \ which might be treated as escape characters ( like \n)

../.. is relative path, in this case, two levels up. .. represents parent of current directory and so on.