Seriously, read MSDN documentation.
The following function and a buch of other in that
Path
class will hell you a lot with file name manipulation.
Path.GetFileNameWithoutExtension Method [
^]
By the way, Google is a good tool to find in seconds the answer to such questions.