O'Reilly logo

Start Here!™ Fundamentals of Microsoft® .NET Programming by Rod Stephens

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Scope, Accessibility, and Lifetime

Scope, accessibility, and lifetime are closely related topics that deal with the situation when a variable (or routine, program-defined type or other programming item) exists and is usable by the program’s other pieces of code.

Scope

An item’s scope includes the code that can use the item. To make programs manageable, code can be divided in several ways. For example, different structures or classes can contain methods that contain code. In Visual Basic, at least, a code module also can contain routines that exist outside of any structure or class.

The scope of a program item (variable, routine, method, and so forth) is generally determined by the level at which it is defined. For example, if a variable is declared ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required