C# Variable Scope and Code Blocks

C# Code Snippets Code Blocks And Scope
Share:

About

In this code snippet, we will take a look at variable scope and code blocks in C#.

A code block is the space between two { }. Variables can be considered out of or in scope depending on whether they are accessible or not from a particular code block. 

Let’s just have a look at the code below.

Code:

Resulting output:

Share:

Leave a Reply

Your email address will not be published.

The following GDPR rules must be read and accepted:
This form collects your name, email and content so that we can keep track of the comments placed on the website. For more info check our privacy policy where you will get more info on where, how and why we store your data.

Advertisment ad adsense adlogger