Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

#region

Status
Not open for further replies.

Alcar

Programmer
Sep 10, 2001
595
US
A helpful tool to use is the #region identifier. This helps us to isolate rows of code one from another into logical structures. Eg.

private int Add(string strFirstParam, string strSecondParam)
{

#region Declare your local variables

int iParam1; // int variable where to store the value of the first parameter
int iParam2; // int variable where to store the value of the second parameter
int iResult; // int variable where to store the result

#endregion

#region Assign the values of the string to the variables

iParam1 = int.Parse(strFirstParam); // parse the string to get the int value
iParam2 = int.Parse(strSecondParam); // parse the string to get the int value

#endregion

#region Add the two numbers and return the result

iResult = iParam1 + iParam2; // add the two parameters
return iResult; // return the result variable

#endregion

}
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top