Region markers allow you to define sections of text that can be hidden or shown as desired. You add region markers by typing the Region directive along with a region name as follows:
In VB:
#Region "Properties" #End Region
In C#:
#region Properties #endregion
When the region is closed, the region name appears in the IDE. When the region
is open, the Region directive and all information within the region is
displayed. These are great for organizing your code.
NOTE: Region directives have no impact on the execution of your application.
When you execute a statement with multiple logical AND or OR conditions, each expression is evaluated. For example:
In VB:
If sUserName = "" or sPassword = "" then
Messagebox.Show("You must enter the Username and Password")
End If
In C#:
if (sUserName == "" | sPassword == "")
{
Messagebox.Show("You must enter the Username and Password");
}
In this example, both the sUserName field and sPassword field are checked. If you want to skip evaluation of the second expression when it is not necessary, use short-circuiting. For example:
In VB:
If sUserName = "" orElse sPassword = "" then
Messagebox.Show("You must enter the Username and Password")
End If
In C#:
if (sUserName == "" || sPassword == "")
{
Messagebox.Show("You must enter the Username and Password");
}
By using short-circuiting, the second expression is not evaluated unless necessary.
Short-circuiting operators conditionally evaluate the second expression as follows:
| All contents © 2004 InStep Technologies, Inc. All rights reserved. |