Skip to content

I used c# embedded method-function in this project. I am happy to share this with you.

Notifications You must be signed in to change notification settings

CeyhunAslan/CSharp_Fundamentals

Repository files navigation

CSharp_Fundamentals

I used c# embedded method-function in this project. I am happy to share this with you.

İf-Else

C# provides many decision-making statements that help the flow of the C# program based on certain logical conditions. Here, you will learn about if, else if, else, and nested if else statements to control the flow based on the conditions.

Switch-Case

In C#, Switch statement is a multiway branch statement. It provides an efficient way to transfer the execution to different parts of a code based on the value of the expression. The switch expression is of integer type such as int, char, byte, or short, or of an enumeration type, or of string type. The expression is checked for different cases and the one match is executed.

For - Loop

In c#, for loop is useful to execute a statement or a group of statements repeatedly until the defined condition returns true. Generally, for loop is useful in c# applications to iterate and execute a certain block of statements repeatedly until the specified number of times.

While - Loop

In c#, While loop is used to execute a block of statements until the specified expression return as true.

Do-While - Loop

In c#, the Do-While loop is used to execute a block of statements until the specified expression return as true. Generally, in c# the do-while loop is same as the while loop, but only the difference is while loop will execute the statements only when the defined condition returns true, but the do-while loop will execute the statements at least once because first it will execute the block of statements and then it will checks the condition.

Foreach - Loop

In c#, the Foreach loop is useful to loop through each item in an array or collection object to execute the block of statements repeatedly. Generally, in c# Foreach loop will work with the collection objects such as an array, list, etc., to execute the block of statements for each element in the array or collection. After completing iterating through each element in the collection, control will be transferred to the next statement following the foreach block. In c#, we can use a break, continue, goto and return statements within the foreach loop to exit or continue to the next iteration of the loop based on our requirements. # Try- Catch In c#, the try-catch statement is useful to handle unexpected or runtime exceptions that will occur during the program's execution. The try-catch statement will contain a try block followed by one or more catch blocks to handle different exceptions.

Functions

Using functions in C# allows you to repeatedly run the code block you have created anywhere in the program. The function you created can be used both in the project and out of the project, one or more times, privately or openly. In this way, we will not repeat the same codes by using a function, and we will alleviate our work by correcting it in one place when it needs to be corrected. You can look at the sample special function I made.

Methods

In c#, Method is a separate code block, and that contains a series of statements to perform particular operations. Methods must be declared either in class or struct by specifying the required parameters.

Cinema Ticket My Project

#Sing In - Sing Up My Project