int MyMethod() { return 9; } int n = MyMethod(); That's all your code is doing, it's no mystery.
Revant Jain wrote:
If so when CountIt count = counter(); is executed it calls counter() and then just initializes the CountIt object an return it, does it actually go into the anonymous method block code? If not why?
counter() returns an object, which is a delegate. So, this works. When the delegate fires, it will run the anonymous code, because that's how the delegate was defined. The code is convoluted, but it's correct.
Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )