Here two methods below that uses SPSecurity.RunWithElevatedPrivileges()
. I just want to know the difference between two?
Method 1:
public void Method1(SPUser user)
{
if (RequireImpersonation == true)
SPSecurity.RunWithElevatedPrivileges(delegate() { PerformRemoveFromVisitorsGroup(user); });
else
PerformRemoveFromVisitorsGroup(user);
}
Mehtod 2:
public void Method2(SPUser user)
{
if (RequireImpersonation == true)
SPSecurity.RunWithElevatedPrivileges(() => PerformRemoveFromVisitorsGroup(user));
else
PerformRemoveFromVisitorsGroup(user);
}