How to Exit/Close an App in Windows Phone 8/8.1(Silverlight) App

In this Code Snippet , you will know how to exit or close an app in Windows Phone 8/8.1 through C# Code. Most of the app You have seen showing "Do You Want to Exit App".When your at last Page or Some other Page(Depends on App Functionality).So To Do This Just Copy and Paste The Code Below in Which you want to Exit .
 
If you have Any Doubts Comment Below.
  1. protected override void OnBackKeyPress(System.ComponentModel.CancelEventArgs e)   
  2. {  
  3.     MessageBoxResult Exit = MessageBox.Show("Do You Want To Exit?""Attention !!!", MessageBoxButton.OKCancel);  
  4.     if (Exit == MessageBoxResult.OK)   
  5.     {  
  6.         Application.Current.Terminate(); //Terminates App    
  7.     }  
  8.     else if (Exit == MessageBoxResult.Cancel)   
  9.     {  
  10.         e.Cancel = true;  
  11.     }  
  12. }