Check the functions below, please:
public void DoJob()
{
CheckPrivilege();
DoJob2();
}
public void DoJob2()
{
CheckPrivilege();
DoJob3();
}
As you can see, if I call DoJob()
, the CheckPrivilege()
function runs twice. Sometimes I can call DoJob2()
directly so I cannot remove CheckPrivilege()
function from DoJob2()
.
So I need to know that the CheckPrivilege()
function is called in another function which is in same call stack.
That is, I want to share a Privilege object over a call stack.
Is this possible? If yes, how?