Current .Net Version: 1.1.4322
Home
Articles
Practice C# Online
C# Reference
XML Web Services
RSS Feeds
T-SQL Scripts
Valuable Links
Contact Us
C# Reference
List: Search:

block
Is a:Definition
Applies to Version:C# 1.0 and later
Namespace:N/A
Assembly:N/A (N/A)
Description:Any block of code surrounded by left and right brackets. Any variables defined within a code block are only accessible with the block and not from any parent blocks beneath it. However, any variables defined within a parent code block is accessible from the nested block.
Syntax:
{ statement }
or ...
{
	/* parent block */
	{ /* nested block */ }
}
Example(s):// Code block by itself - although wierd, very valid syntax: { String strMyString = "Hello!"; } // We won't be able to use strMyString from outside of its // code block! Oh well! // try-catch code blocks try { // try code block... } catch { // catch code block... }
 
COPYRIGHT/DISCLAIMER | CONTACT US