How to close a Windows phone app programmatically using c#

In Windows phone the apps are typically terminated by the user pressing the back button. But at times there may be a situation at times that one may want to terminate the application programmatically. So as to close the application programmatically using c# we have the API given below.


For Windows phone 8.1(Universal apps)



For Windows phone 8



Note: Make sure to save important data before calling this API. No events will be fired following termination.