string myFilePath = @"C:\MyFile.txt";
string ext = Path.GetExtension(myFilePath);
// ext would be ".txt"
More Related Contents:
- Is there a way to check if a file is in use?
- Natural Sort Order in C#
- Easiest way to read from and write to files
- Rename a file in C#
- Nested using statements in C#
- How to find the most recent file in a directory using .NET, and without looping?
- Save and load MemoryStream to/from a file
- Accessing Password Protected Network Drives in Windows in C#?
- Better way to check if a Path is a File or a Directory?
- How to detect a USB drive has been plugged in?
- C# – Get a list of files excluding those that are hidden
- c# open file with default application and parameters
- Should I store my images in the database or folders? [duplicate]
- How to get files in a relative path in C#
- Encode a FileStream to base64 with c#
- How to check if System.Net.WebClient.DownloadData is downloading a binary file?
- What’s the least invasive way to read a locked file in C# (perhaps in unsafe mode)?
- Can I simply ‘read’ a file that is in use?
- File System TreeView
- Writing file to web server – ASP.NET
- ReadAllLines for a Stream object?
- How to get the actual (localized) folder names? [duplicate]
- Open a file with Notepad in C#
- Read random line from a file? c#
- What is the difference between File and FileInfo in C#?
- Find all files in a folder
- How do I get File Type Information based on extension? (not MIME) in c#
- Delete files older than 3 months old in a directory using .NET
- Creating download link to a file on a file server
- Find a file within all possible folders?