C# Comments Example

Adding comments while coding is a very good practice.  Most of the times, we end up writing very lengthy code and at that time, just to remember what a particular block of code will actually do, we use comments.   The comments in C# code also important and helpful for other team members who are helping

Continue Statement

C# continue statement is used to skip some piece of code inside the loop.  In some cases, you don’t want to execute some piece of code during your looping process, then this statement comes in handy.  The C# sample code is given below to demonstrate the use of continue statement where we are skipping 1

Break Statement

C# break statement is used to break a loop.  In some cases, at certain point you want to break a loop and want to stop the execution when you find the exact match as per your requirement.  In such cases, you can make use of break statement.  Let me elaborate it a bit more, suppose

Foreach Loop

C# foreach loop basically used for an iteration purpose.  In that iteration process, we loop through an collection object and display or manipulate the each object in that collection based upon our requirements.  For example, if you have an object like an array which contains bunch of names and  you want to display all the

Do While Loop

C# do while loop is pretty much like a while loop.  The only difference is, your code inside the loop will be executed at least once regardless to your loop condition, which will be checked after the execution of your code inside the loop.  The C# sample code is given below and it is pretty