C# DirectoryInfo Name
Description
DirectoryInfo Name
Gets the name of this DirectoryInfo
instance.
Syntax
DirectoryInfo.Name
has the following syntax.
public override string Name { get; }
Example
The following example displays the name of the current DirectoryInfo instance only.
/*from w w w. j a v a 2 s.c o m*/
using System;
using System.IO;
class GetAName
{
public static void Main(string[] args)
{
DirectoryInfo dir = new DirectoryInfo(".");
String dirName=dir.Name;
Console.WriteLine(dirName);
}
}
The code above generates the following result.