I have a website, there is a method like this:
public Context GetContext()
{
...
}
This method will be called several times when a user login to the website, and the method will return some information.
Now I have an other thread start by the website, the thread will do something. And the in the thread job this method also will be called several times.
The problem is, in these two situation, the method should return different result, for some reason I can't use another method or add parameters to the method.
Is there anyway to identify the current thread in a method? Basically, I want to archive something like this:
var thread = new Thread(GetContext);
thread.SomeFlag = True.
thread.Start()
public Context GetContext()
{
Var thread = GetCurrentThread();
If(thread.SomeFlag == True)
//do some thing...
Else
//do some thing...
}
Is that possible?