Impersonate: use specified credential to execute some code in C#
Insomescenariosweneedrunsomecodeundersomespecifiedcredential:1.YouwanttorunawindowsservicewhichtocopyfiletoaUNCpath,buttheITdon'tletyouto usethedomainaccounttoruntheservice,andthelocaladminaccountdon'