No, there's no such thing in C#. All state that you want to persist across multiple method calls has to be in fields, either instance or static.
No, there's no such thing in C#. All state that you want to persist across multiple method calls has to be in fields, either instance or static. Except... if you capture the variable in a lambda expression or something like that.
For example: public Func GetCounter() { int count = 0; return () => count++; } Now you can use: Func counter = GetCounter(); Console. WriteLine(counter()); // Prints 0 Console. WriteLine(counter()); // Prints 1 Console.
WriteLine(counter()); // Prints 2 Console. WriteLine(counter()); // Prints 3 Now of course you're only calling GetCounter() once, but that "local variable" is certainly living on well beyond the lifetime you might have expected... That may or may not be any use to you - it depends on what you're doing. But most of the time it really does make sense for an object to have its state in normal fields.
– sq33G Dec 14 at 22:03 @sq33G: It depends on exactly how you're using it, I think... – Jon Skeet Dec 14 at 22:07.
You'd have to create a static or instance member variable of the class the method is in.
Public class Foo { static int _bar = 1; public int Bar() { return ++_bar; } }.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.