C# DirectoryInfo Root

Description

DirectoryInfo Root Gets the root portion of the directory.

Syntax

DirectoryInfo.Root has the following syntax.


public DirectoryInfo Root { get; }

Example

The following example displays root locations for specified directories.


using System;/*from w  w  w  .j  av a  2 s .co  m*/
using System.IO;

class Program
{
    static void Main(string[] args)
    {
        DirectoryInfo di = new DirectoryInfo(@"c:\");
        Console.WriteLine(di.Root);
    }
}

The code above generates the following result.





















Home »
  C# Tutorial »
    System.IO »




BinaryReader
BinaryWriter
Directory
DirectoryInfo
DriveInfo
File
FileInfo
FileStream
MemoryStream
Path
StreamReader
StreamWriter
StringReader
StringWriter