From where you got this line. Use the link I gave you it works for me
1. Add Reference of System.DirectoryServices.AccountManagement from .Net Tab in Add Reference
2. Add following namespace
using System.DirectoryServices.AccountManagement;
using System.Security.Principal;
3. Then use the following code
private void Form1_Load(object sender, EventArgs e)
{
string userName = WindowsIdentity.GetCurrent().Name.Split('\\')[1];
string machineName = WindowsIdentity.GetCurrent().Name.Split('\\')[0];
PrincipalContext c = new PrincipalContext(ContextType.Machine, machineName);
//Specific User
UserPrincipal uc = UserPrincipal.FindByIdentity(c, "Mudassar");
DateTime? LoggedInTime = uc.LastLogon;
//Current LoggedIn User
uc = UserPrincipal.FindByIdentity(c, userName);
DateTime? CurrentUserLoggedInTime = uc.LastLogon;
}