How to Log off from Windows programmatically using C# ?

Below is a simple program that lets you to Log off Windows programmatically using C# . The P/Invoke's ExitWindowsEx method is used to Log off from Windows using C# .
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication1
{  
  Read More →