Maybe this sample help you:
// create a reference to the current directory
DirectoryInfo di = new DirectoryInfo(Environment.CurrentDirectory);
// create an array representing the files in the current directory
FileInfo[] fi = di.GetFiles();
Console.WriteLine("The following files exist in the current directory:");
// print out the names of those files
foreach (FileInfo fiTemp in fi)
// get the name od the file througgh the fileInfo class and trim it with the exstension
Console.WriteLine(fiTemp.Name.TrimEnd(fiTemp.Extension.ToCharArray()));