What you are talking about is something like this:
void SomeFunction(void)
{
static int sVar = 1;
...
}
It is possible to do this in
C and
C++, but it is not possible in
C#. Be aware that the
C language is not
object oriented and the
C++ is a
multi paradigm language.
The
C# is a pure
object oriented language and what you are trying to do break the principles of
OOP: if you need a method to persist some state between calls, you should make that state variable a member of the class that contains the method.
Be aware that things that are possible with a programming language, could be not allowed by another language. And again, a coding style could be good with a language and bad with another.