Programming language variables are a lot like fruit flies; they live for a lot less time than you think. This is especially true of local procedure-level variables. The C language included a feature called static variables that extended the lifetimes of local variables well beyond those of their peers.
C#, the direct descendant of C, lacks this feature, but it lives on—and for much longer than you might expect—in Visual Basic. Despite its absence from C#, there are workarounds that may allow those migrating from Visual Basic to keep enjoying this feature. Read all about it in my latest article from Visual Studio Magazine, “Local Static Variables in Visual Basic and C#.” Long live static variables!
[Image Credits: Visual Studio Magazine]