It was interesting to me...
When I have a code like this:
lock (obj) { MyCode.MyAgent(); }
Can MyAgent contain code that recognizes that it works under a lock block?
What about:
for (int i=0;i<5;i++) { MyCode.MyAgent(); }
Can MyAgent contain code that recognizes that it works under a loop block?
You can ask the same question for using blocks, unsafe code, etc ... - well, you get the idea ...
Is this possible in C #?
This is just a theoretical question, I'm not trying to achieve anything ... just knowledge.
Royi namir
source share