C# FileInfo Extension
Description
FileInfo Extension
Gets the string representing the
extension part of the file.
Syntax
FileInfo.Extension
has the following syntax.
public string Extension { get; }
Example
// w ww .j a v a 2 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.Extension);
}
}
The code above generates the following result.