Clear temparary files from temp folder of internet explorer using .net code

To Clear temporary files from temp folder of internet explorer by .net code you can try below code in any event to check the effect.

 "using System.IO;"  
 void clearTempfolder(DirectoryInfo MyDirPath)  
 {  
   foreach (FileInfo yourFile in MyDirPath.GetFiles())  
   {  
     yourFile.Delete();  
   }  
   foreach (DirectoryInfo youSubFolder in MyDirPath.GetDirectories())  
   {  
    clearTempfolder(youSubFolder );  
   }  
 }  
 public static void Main()  
 {  
  clearTempfolder(new   DirectoryInfo(Environment.GetFolderPath(Environment.SpecialFolder.InternetCache)));  
 }