You will first need to use Directory.GetFiles method to get all the files with given extension. Like this:
string[] filesToDelete = Directory.GetFiles("c:\\test", "*.txt");
Then, if you are using .Net 3.0 or higher, you can use this:
filesToDelete.ToList().ForEach(file => File.Delete(file));
Or loop through the array elements and delete each item one by one. A loop would be better since it would let you handle the cases where you do not have rights to delete a file or if the file is in use.