J
JT
Hi,
I like to output log to help with debugging. When there's a lot of recursive
functions, I like to increase the indentation of each line so I know where I
am "in the recursiveness". To do that indentation (when I program in c++), I
use a class that increases the indentation in the consturctor, and decreases
it in the destructor. When an instance of that class goes out of scope, the
indentation is automatically decreased. It works great.
Anyway, is there a way to do that in C#? I quickly ported my C++ code, but
quickly noticed that the destructor wasn't getting called. So the
indentation kept increasing, never decreasing. Is there any way to have a
member function called as soon as a variable goes out of scope in c#?
Thanks
JT
I like to output log to help with debugging. When there's a lot of recursive
functions, I like to increase the indentation of each line so I know where I
am "in the recursiveness". To do that indentation (when I program in c++), I
use a class that increases the indentation in the consturctor, and decreases
it in the destructor. When an instance of that class goes out of scope, the
indentation is automatically decreased. It works great.
Anyway, is there a way to do that in C#? I quickly ported my C++ code, but
quickly noticed that the destructor wasn't getting called. So the
indentation kept increasing, never decreasing. Is there any way to have a
member function called as soon as a variable goes out of scope in c#?
Thanks
JT