At the moment, I have some functions which look like this:
private bool inFunction1 = false;
public void function1()
{
if (inFunction1) return;
inFunctio
There is no such attribute predefined. You can make new attributes, but that won't help you. The issue is making the custom attribute prevent the method being called again, which I don't think is doable.
The lock statement is not what you want, since that will cause calls to block and wait, not return immediately.
PS: use a try ... finally block in the above sample. Otherwise, if an exception is thrown in the middle of the function, inFunction1 will be left true and all calls will return immediately.
e.g. :
if (inFunction1)
return;
try
{
inFunction1 = true;
// do stuff which might cause function1 to get called
...
}
finally
{
inFunction1 = false;
}