| Below is the code to get the extenstion of the file in csharp. Here i have used a text file and get its extenstion.
using System;
using System.IO;
class Program
{
static void Main()
{
string filepathnName = @"C:\crackyourinterview.txt";
string e = Path.GetExtension(filepathnName);
if (e == ".txt")
{
Console.WriteLine(e);
}
}
} | | |