C# FileInfo DirectoryName
Description
FileInfo DirectoryName
Gets a string representing the
directory's full path.
Syntax
FileInfo.DirectoryName
has the following syntax.
public string DirectoryName { get; }
Example
Gets a string representing the directory's full path.
/*from w w w .j av a2 s.c o m*/
using System;
using System.IO;
public class DirectoryTest
{
public static void Main()
{
FileInfo fi = new FileInfo("temp.txt");
Console.WriteLine(fi.DirectoryName);
}
}
The code above generates the following result.