I would like to write my own custom compound statements that have a similar mechanism for mechanisms usingand lockwhere they have the code introduced at the beginning and at the end of the statement block before compilation.
I tried to find answers to questions that might have asked similar questions, but I could not correctly understand what kind of code is called, except for documentation saying that these are complex statements.
I know that “blocking” and “using” are keywords. I do not want to have my own keywords, because I know that this is not possible.
Not sure if this is possible in C #, for example:
Instead of doing:
StartContext(8);
EndContext();
This can be reduced to:
DoSomethingInContext(8) {
}
, . , .