Is there a way to determine which class called a static method in .NET
<p>We have a central <strong>STATIC</strong> method that get's called from many different locations of our ASP.NET application.</p>

<p>I need to add some conditional logic to the static method that needs to run only if the method was called from a specific class. One approach would be to add an additional parameter to the static method's signature -- some kind of enum that would represent which class called this static method, but I was hoping .NET offered a more elegant approach.</p>

<p><strong>EDIT: See Sample Code below</strong></p>

<p>I am trying to modify how exceptions are handled. Currently, if we are processing 1000 checks, and there is an exception inside the loop at check 500, checks 500 - 1000 will not be processed. </p>

<p>We have several screens on our website that calls this central method. One of them called Check Creation Wizard, another called ACH Creation Wizard, etc. Well for the ACH Creation Wizard, we want to handle exceptions by simply skipping a failed check, and move on to the rest of the checks. However, for all other wizards, we want to continue failing the remaining batch of checks if one fails.</p>

<pre><code>public static string GenerateChecks(List&lt;CheckJob&gt; checkJobs)
{
    foreach (CheckJob check in checkJobs)
    {
        try
        {
            bool didGenerate = DoGenerate(check);
            if(didGenerate)
            {
                Account acct = LoadAccount(check.GetParent());
                ModifyAccount(acct);
                SaveAcct(acct);
            }
        }           
        catch (Exception ex)
        {
            if (Transaction.IsInTransaction)
            {
                Transaction.Rollback();
            }

            throw;
        }
    }
}
</code></pre>