DirectoryInfo.Parent : DirectoryInfo « System.IO « C# / C Sharp by API






DirectoryInfo.Parent

 
using System;
using System.IO;

class MainClass
{
    public static void Main(string[] args)
    {
        FileInfo file = new FileInfo("c:\\test.txt");

        // Display directory information.
        DirectoryInfo dir = file.Directory;

        Console.WriteLine("Checking directory: " + dir.Name);
        Console.WriteLine("In directory: " + dir.Parent.Name);
        Console.Write("Directory exists: ");
        Console.WriteLine(dir.Exists.ToString());

    }
}

   
  








Related examples in the same category

1.new DirectoryInfo(String path)
2.DirectoryInfo.CreateSubdirectory
3.DirectoryInfo.CreationTime
4.DirectoryInfo.Exists
5.DirectoryInfo.FullName
6.DirectoryInfo.GetDirectories()
7.DirectoryInfo.GetFiles()
8.DirectoryInfo.GetFiles(String filter)
9.DirectoryInfo.LastAccessTime
10.DirectoryInfo.LastWriteTime
11.DirectoryInfo.Name