Getting a file extension in C # is very simple,
FileInfo file = new FileInfo("c:\\myfile.txt");
MessageBox.Show(file.Extension); // Displays '.txt'
However, I have files in my application with multiple periods.
FileInfo file = new FileInfo("c:\\scene_a.scene.xml");
MessageBox.Show(file.Extension); // Displays '.xml'
I want to get a part of the .scene.xmlname.
Update
Extension should also include an initial.
How can I get this from FileInfo?
source
share