Posts by Pawan Shukla
Page 5 of 12

C# Lock Statement

In this article i am explaining about lock statement in c#. The lock statement handle lock segment as a critical section and lock the object during the execution of program from other thread. Once the execution is completed it releases the lock and frees objects. Example: using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace […]

Continue Reading →
 

C# Unchecked Statement

In this article i am explaining about Unchecked key word. The unchecked statement ignores the stack overflow exception and executes the program so, the output can be incorrect. Example: using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Unchecked_Statement {     class Program     {         static void Main(string[] args)         {             int n;             // assign maximum value             n = int.MaxValue; […]

Continue Reading →
 

C# Checked Statement

In this article about checked statement. The checked statements force fully C# to raise exception whenever underflow or stack overflow exception occurs due to integral type arithmetic or conversion issues. Example: using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace CheckedStatementExample {     class Program     {         static void Main(string[] args)         {             int n;             // assign maximum […]

Continue Reading →
 

C# Throw Statement

In this article i am explaining about Throw Exception. Throw statement is used for throwing exception in a program. The throwing exception is handled by catch block. Example: using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Throw_Statement_Example { class Program { static void Main(string[] args) { int n1, n2, result; Console.WriteLine(“Enter First Number”); n1 […]

Continue Reading →
 

C# Return Statement

A return statement is used for returning value to the caller from the called function. A very  easy example is mentioned below in a program that demonstrate the return statement very clearly and easy. Example: using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Return_Statements {     class Program     {         public int Add(int n1, int n2) […]

Continue Reading →
 

C# Continue Statements

The continue statements enables you to skip the loop and jump the loop to next iteration. Example: using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Continue_Statements_Example { class Program { static void Main(string[] args) { int i = 0; while (i < 10) { i++; if (i < 6) { continue; } Console.WriteLine(i); } […]

Continue Reading →
 

C# Break Statement

The break statement is used to terminating the running statement of program and transfer controls to the next execution. Example: using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Break_Statements_Example {     class Program     {         static void Main(string[] args)         {             int i = 0;             while (i < 100)             {                 Console.WriteLine(i);                 if (i == 20)                 {                     Console.WriteLine(“Breaking the […]

Continue Reading →
 

C# Goto Statement

The goto statement is a jump statement that controls the execution of the program to a different section of an equivalent program. You produce label at anywhere in program then will pass the execution management via the goto statements. Example: using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace GoTo_Statements_Example { class Program { static […]

Continue Reading →
 

C# Empty Statement

Empty statement is used when you no need to perform an operation where a statement is required. It simple and easy transfers control to the end point of the statement. It is  very useful with while loop with blank body and label statements. Example: using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace EmptyStatementExample { […]

Continue Reading →